## 4 Hudsonia matrices
pfister.plot(hudsonia)
## 3 Mimulus cardinalis matrices at Carlon
mim <- subset(monkeyflower, species == "cardinalis" &
site == "Carlon" & year != "pooled", select = c(4:19))
## convert data frame to list of matrices using split
mim1 <-split(mim, 2000:2002)
mim2 <-lapply(mim1, matrix, nrow=4, byrow=TRUE)
vr1 <- pfister.plot(mim2)
vr1
## PLOT using labels
plot(vr1$cv, vr1$elas, xlab="CV", ylab="Elasticity", log="xy", type='n')
# Split matrix elements into transitions representing F (fertility),
# S (survival), G (growth), and R (retrogression).
# Fertility on top row, survival on diagonal, growth is above diagonal
# and retrogression below diagonal.
rownames(vr1)
y2 <- expression(S[11],G[21],G[31],G[41],
F[12],S[22],G[32],G[42],
F[13],R[23],S[33],G[43],
F[14],R[34],S[44])
text(vr1$cv, vr1$elas, y2)
### add trend line
abline(lm(log10(vr1$elas)~log10(vr1$cv)), col="red")
## include Spearman's rank correlation
a <- cor.test(vr1$cv, vr1$elas, method="spearman")
a
text(10, .0015, substitute(rho == x, list(x=round(a$estimate,2))), col="blue")
Run the code above in your browser using DataLab