Closed willpearse closed 5 years ago
> comm <- matrix(c(0,1,1,0), 2, 2) > comm [,1] [,2] [1,] 0 1 [2,] 1 0 > rownames(comm) <- c("pond 1", "pond 2") > colnames(comm) <- c("pondweed", "grass") > comm pondweed grass pond 1 0 1 pond 2 1 0 > long.format <- data.frame(species=c("pondweed","pondweed","grass","grass"), site=c("pond 1","pond 2","pond 1","pond 2"), count=c(0,1,1,0)) > long.format species site count 1 pondweed pond 1 0 2 pondweed pond 2 1 3 grass pond 1 1 4 grass pond 2 0
picante::sample2matrix
sample2matrix(long.format[,c(2,3,1)])
matrix2sample
BUT remember that presence --> -1, and absence --> 0. It is important to keep this distinction!!!
No need for this anymore...