[R] Combine two matricies

2009-07-13 Thread Tom Liptrot
Hi, I have two matricies a and x: a<-matrix(c(3,4,5,2,3,4,1,1,2), nrow=3, ncol=3) [,1] [,2] [,3] [1,]321 [2,]431 [3,]542 x<-matrix(c(3, NA, NA, NA, 2, 5, NA, 2, 2), nrow=3, ncol=3) [,1] [,2] [,3] [1,]3 NA NA [2,] NA22 [3,] NA52

[R] Add grand mean to every entry in a matrix

2009-07-13 Thread Tom Liptrot
Hi, I have a matrix: mymat <- matrix(runif(10*4), ncol=4) I wish to subtract the column means, down the colums, subtract the row means from the rows and add back the grand mean - all the means should be the means of mymat rather than of the new matrix. How can I do this? Any help much appr

[R] Change data frame column names

2009-07-15 Thread Tom Liptrot
Hi R helpers, I have a data frame and I want to change the column names to names I have held in another data frame, but I am having difficulty. All data framnes are large so i can't input manually. Below is what i have tried so far: df<-data.frame(a=1:5, b=2:6, d=3:7, e=4:8) coltitles<-data

Re: [R] Change data frame column names

2009-07-15 Thread Tom Liptrot
: tomlipt...@hotmail.com > CC: r-help@r-project.org > Date: Wed, 15 Jul 2009 16:12:32 +0100 > > On Wed, 2009-07-15 at 14:35 +, Tom Liptrot wrote: > > > > > > > > Hi R helpers, > > > > I have a data frame and I want to change the column names to name