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: [EMAIL PROTECTED] www: http://wwwuser.gwdg.de/~uaoe/mitarbeiter/y_clough.htm ______________________________________________ [email protected] mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide! http://www.R-project.org/posting-guide.html
