[R] Fill a matrix using logical arguments?
alistair.auffret at natgeo.su.se
Wed May 26 14:50:32 CEST 2010
I am going slightly mad trying to create a table for running
What I have is seed bank and vegetation data, and my aim is to see if
the vegetation found in a site (containing several seed bank samples)
can predict the composition of a seed bank sample within that site. So
for this I need two tables with matching rows.
I have created an empty matrix, where the rows correspond to the seed
bank.plot<-matrix(,5,3,dimnames=list(c("AB 01 01", "AB 01 02", "AB 02
01","AB 03 01","AB 03 02"),c(1:3)))
And I have a matrix where I have presence/absence of species in the
vegetation at each site.
site.veg<-matrix((c(1,0,1,1,0,1,0,1,1)),3,3,dimnames=list(c("AB 01", "AB
02", "AB 03")))
Is there a way to fill the bank.plot matrix with the results from the
vegetation survey, duplicating them appropriately to match sites to
plots, even when the number or sites per plot are unequal? i.e. in my
example, the row AB 01 in site.veg would be duplicatied for the first
two rows, AB 02 only once, and AB 03 twice.
Hope you can help!
Department of Physical Geography and Quaternary Geology
106 91 Stockholm
+46(0)8 674 7568
More information about the R-help