{"title":"Population modelling including spatially explicit models.","authors":"D. Quicke, B. A. Butcher, R. K. Welton","doi":"10.1079/9781789245349.0303","DOIUrl":null,"url":null,"abstract":"Abstract\n R is an open-source statistical environment modelled after the previously widely used commercial programs S and S-Plus, but in addition to powerful statistical analysis tools, it also provides powerful graphics outputs. R can be used for some quite fast modelling jobs but its speed is nowhere near that of a compiled programming language such as C++. This chapter shows how user-defined functions can be used to perform highly repetitive jobs efficiently, and demonstrates various mathematical functions. The first example shows how a vector can be incremented and the calculated points plotted on a graph as the simulation proceeds. The second example runs a loop, and each time passes values to a user-defined function, and receives back multiple values from that function, which it then stores for plotting later. The third example is necessarily more complex and shows how R code can be used to carry out spatially explicit analyses. Finally, a simple example shows how R can be used to teach how evolution takes place, even in the absence of natural selection due to genetic drift and population bottle-necking.","PeriodicalId":167700,"journal":{"name":"Practical R for biologists: an introduction","volume":"49 1","pages":"0"},"PeriodicalIF":0.0000,"publicationDate":"1900-01-01","publicationTypes":"Journal Article","fieldsOfStudy":null,"isOpenAccess":false,"openAccessPdf":"","citationCount":"0","resultStr":null,"platform":"Semanticscholar","paperid":null,"PeriodicalName":"Practical R for biologists: an introduction","FirstCategoryId":"1085","ListUrlMain":"https://doi.org/10.1079/9781789245349.0303","RegionNum":0,"RegionCategory":null,"ArticlePicture":[],"TitleCN":null,"AbstractTextCN":null,"PMCID":null,"EPubDate":"","PubModel":"","JCR":"","JCRName":"","Score":null,"Total":0}
引用次数: 0
Abstract
Abstract
R is an open-source statistical environment modelled after the previously widely used commercial programs S and S-Plus, but in addition to powerful statistical analysis tools, it also provides powerful graphics outputs. R can be used for some quite fast modelling jobs but its speed is nowhere near that of a compiled programming language such as C++. This chapter shows how user-defined functions can be used to perform highly repetitive jobs efficiently, and demonstrates various mathematical functions. The first example shows how a vector can be incremented and the calculated points plotted on a graph as the simulation proceeds. The second example runs a loop, and each time passes values to a user-defined function, and receives back multiple values from that function, which it then stores for plotting later. The third example is necessarily more complex and shows how R code can be used to carry out spatially explicit analyses. Finally, a simple example shows how R can be used to teach how evolution takes place, even in the absence of natural selection due to genetic drift and population bottle-necking.