Skip to content

Sarracenia purpurea

cstubben edited this page Apr 10, 2012 · 1 revision

The following code will scan the projection matrix at Hawley Bog in Table 1 from

Gotelli, N.J. and A.M. Ellison. 2006. Forecasting extinction risk with nonstationary matrix models. Ecological Applications 16:51-61.

First, type the scan command below and then using the pdf document, copy the 4 lines under Hawley Bog in Table 1 and then paste the results into R. Be sure to enter a blank line to terminate the input on the screen. Second, select the stages (in position 1, 10, 19, 29) to assign to the row and column names, use the grep function to list only numeric elements (with digits or a decimal point) and finally convert the vector to a square matrix.

x1 <- scan(, what="")
Recruit 0.0000 (0) 0.0000 (0) 0.0000 (0) 4.0000 (0)
Juvenile 0.1000 (2) 0.9540 (61) 0.0900 (2) 0.0000 (0)
Non-flowering adult 0.0000 (0) 0.0360 (3) 0.7010 (18) 0.8375 (5)
Flowering adult 0.0000 (0) 0.0000 (0) 0.1802 (6) 0.1610 (1)

stages <- x1[c(1, 10, 19, 29)]
sapu <- matrix2(as.numeric(grep("^[0-9.]+$", x1, value = TRUE)),
stages)
lambda(sapu)
[1] 1.004558
Clone this wiki locally