-
Notifications
You must be signed in to change notification settings - Fork 5
20 perennial plants
cstubben edited this page Apr 15, 2013
·
6 revisions
The following code will download the 461 projection matrices from 20 plant populations in
Ellis, MM, JL. Williams, P Lesica et al 2012. Matrix population models from 20 studies of perennial plant populations. Ecology 93:951
url <- "http://esapubs.org/archive/ecol/E093/083/Transition_Matrices.txt"
x <- read.delim(url, stringsAsFactors=FALSE)
table(x$SPP)
ARFE ASSC ASTY CIPI CYFA DIFR ERCU GEPN HARA HOCO HYCU LAVE LISC LOCO NEMA PHEM PHIN SIAC SISP TRGR
14 31 35 35 9 50 40 7 64 6 30 29 15 10 5 5 5 20 12 39
Details about each population and stage classes are included in the metadata. Some R code is also included to convert the MATLAB matrix strings, which I have simplified below (remove ; [ ], split the string, convert to number and then format as matrix using matrix2 in popbio package).
convert_mx <- function(mx, ...){
mx <- as.numeric(strsplit(gsub(";|\\[|]", "", mx), " ")[[1]])
matrix2(mx, ...) # option to add stage class names
}
stages<- c("germinants", "seedlings", "1-leaf", "small 3-leaf", "large 3-leaf", "reproductive")
trgr <- subset(x, SPP=="TRGR")
A <- lapply(trgr$Mx, convert_mx, stages)
names(A) <- paste( substr(trgr$POP, 6,7), substr(trgr$YR, 3,4), sep="")
A[[1]]
germinants seedlings 1-leaf small 3-leaf large 3-leaf reproductive
germinants 0.000 0.000 0.00000000 0.0000000 0.00000000 12.9099600
seedlings 0.194 0.000 0.00000000 0.0000000 0.00000000 0.0000000
1-leaf 0.000 0.321 0.82051282 0.0000000 0.00000000 0.0000000
small 3-leaf 0.000 0.000 0.07051282 0.9047619 0.07692308 0.0000000
large 3-leaf 0.000 0.000 0.00000000 0.0952381 0.80769231 0.2884615
reproductive 0.000 0.000 0.00000000 0.0000000 0.11538462 0.7115385
image2(A[[1]], mar=c(1,7,7,1))
sapply(A[1:7], lambda)
DC98 DC99 DC00 DC01 WH99 WH00 WH01
1.0336861 1.0407601 0.9696774 0.9647957 0.9910988 0.8998307 1.0279880