Re: [R] About matrix manipulation

2012-08-21 Thread Rui Barradas
Hello, Try the following. library(reshape2) # Don't need 'cbind' mat <- data.frame(sp1=c(rep(0, 5), rep(1, 5)), sp2=sample(c(rep(0, 6),rep(1, 4))), fac=c(rep("a", 3), rep("b", 3), rep("c", 4))) mat.new <- matrix (c(0, 1, 1, 1, 1, 1), nrow=2, ncol=3) rownames(mat.new) <- c("sp1

[R] About matrix manipulation

2012-08-21 Thread Thiago Gonçalves-Souza
Dear list, I'm trying to create a matrix by combining the sites that species occur in a new matrix with species as rows and sites as columns. The main matrix is "mat": mat <- as.data.frame(cbind(sp1=c(rep(0, 5), rep(1, 5)),sp2=sample(c(rep(0, 6),rep(1, 4))), fac=c(rep("a", 3), rep("b", 3),rep("c

Re: [R] About Matrix

2009-04-28 Thread Martin Maechler
> "TM" == Tammy Ma > on Tue, 28 Apr 2009 11:28:43 +0300 writes: TM> Hi, Dear R users, TM> I have a question: TM> I have A matrix which is 11519X14 TM> and B matrix which is 1764X14, TM> How do I get C matrix which is The remaining matrix after removing B from

[R] About Matrix

2009-04-28 Thread Tammy Ma
Hi, Dear R users, I have a question: I have A matrix which is 11519X14 and B matrix which is 1764X14, How do I get C matrix which is The remaining matrix after removing B from A? Thanks a lot. Kind regards, Tammy _ More than m