[R] randomisation
Yann Clough
y.clough at NS1.uaoe.gwdg.de
Wed Feb 9 14:27:38 CET 2005
I am working on an ecological problem and dealing with a matrix where
rows correspond to samples, and columns correspond to species.
The values in the matrix are recorded abundances of the organisms.
I want to create a series of randomised datasets where total
abundances per sample (rowSums) and per species (colSums) are equal to
those in the dataset of my observations.
Simple example of the kind of thing I have:
matrix(c(1,0,2,10,1,3,5,6,7,1,0,0),nrow=4, ncol=3,by=row) # observed
data
rowSums(tempmatrix) #individuals per location,
colSums(tempmatrix) #individuals per species
example of a matrix which complies with the two restrictions:
tempmatrix2=matrix(c(1,0,2,11,0,3,5,6,7,0,1,0),nrow=4, ncol=3,by=row)
rowSums(tempmatrix2)
colSums(tempmatrix2)
hope this is clear
Cheers
Yann
***************************
Yann Clough
Fachgebiet Agraroekologie
Waldweg 26
D-37073 Goettingen
Tel: 0551/39-2157
email: y.clough at uaoe.gwdg.de
www: http://wwwuser.gwdg.de/~uaoe/mitarbeiter/y_clough.htm
More information about the R-help
mailing list