[R] combine two columns

2005-11-29 Thread Georg Otto
Hi, I have an R programming problem and I havent found anything in the documentation yet: I have a data matrix, in which two neighbouring columns represent replicates of the same experiment, e.g. something like this: A A B B C C row1 1 1 1 2 2 2 row2 1 1 1 1 1 2 I would like to test,

Re: [R] combine two columns

2005-11-29 Thread Sean Davis
On 11/28/05 12:47 PM, "Georg Otto" <[EMAIL PROTECTED]> wrote: > Hi, > > I have an R programming problem and I havent found anything in the > documentation yet: > > I have a data matrix, in which two neighbouring columns represent > replicates of the same experiment, e.g. something like this: >

Re: [R] combine two columns

2005-11-29 Thread TEMPL Matthias
Hello, Following should work. m <- matrix(round(runif(16,0,2)),nrow=2) colnames(m) <- c("A","A","B","B","C","C","D","D") m2 <- m #matrix(, nrow=dim(m)[1], ncol=dim(m)[2]/2) z <- 1 ss <- seq(1,dim(m)[2],2) for(j in ss){ for(i in 1:dim(m)[1]){ m2[i,j] <- substring(m[i,ss[z]] == m[i,ss[z]+1],

Re: [R] combine two columns

2005-11-29 Thread Petr Pikal
Hallo On 28 Nov 2005 at 18:47, Georg Otto wrote: To: r-help@stat.math.ethz.ch From: Georg Otto <[EMAIL PROTECTED]> Date sent: Mon, 28 Nov 2005 18:47:38 +0100 Subject: [R] combine two columns > Hi, > > I have a

Re: [R] combine two columns

2005-11-29 Thread Bill West
,x,compare,a)) --Bill -Original Message- From: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED] On Behalf Of Georg Otto Sent: Monday, November 28, 2005 12:48 PM To: r-help@stat.math.ethz.ch Subject: [R] combine two columns Hi, I have an R programming problem and I havent found anything in the

Re: [R] combine two columns

2005-11-29 Thread Gabor Grothendieck
Try this: > is.odd <- !array(0:1, ncol(mat)) > mat[,is.odd] == mat[,!is.odd] A B C row1 TRUE FALSE TRUE row2 TRUE TRUE FALSE On 11/28/05, Georg Otto <[EMAIL PROTECTED]> wrote: > Hi, > > I have an R programming problem and I havent found anything in the > documentation yet: > > I

Re: [R] combine two columns

2005-11-29 Thread Gabor Grothendieck
And here is one minor variation of this: odd <- seq(1, ncol(mat), 2) mat[,odd] == mat[,odd+1] On 11/29/05, Gabor Grothendieck <[EMAIL PROTECTED]> wrote: > Try this: > > > is.odd <- !array(0:1, ncol(mat)) > > mat[,is.odd] == mat[,!is.odd] >A B C > row1 TRUE FALSE TRUE > row2 TRUE