Re: [R] Fill a matrix using logical arguments?

2010-05-27 Thread Alistair Auffret
Thanks a lot Joris, that worked wonderfully! Another solution which a colleague at the department came up with was this, which avoids curly brackets, which some people may or may not be frightened by... ##matrices bank.plot-matrix(,5,3,dimnames=list(c(AB 01 01, AB 01 02, AB 02 01,AB 03 01,AB

[R] Fill a matrix using logical arguments?

2010-05-26 Thread Alistair Auffret
Hello all, I am going slightly mad trying to create a table for running co-correspondence analysis. 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

Re: [R] Fill a matrix using logical arguments?

2010-05-26 Thread Joris Meys
Hi Alistair, ?match will help, but you need to extract the site names first. Quick and dirty : seed - substr(rownames(bank.plot),1,5) site - rownames(site.veg) for(i in 1:length(seed)){ bank.plot[i,]-site.veg[match(seed[i],site),] } Cheers Joris On Wed, May 26, 2010 at 2:50 PM, Alistair