Re: [R] Correlation between matrices

2011-11-06 Thread Dennis Murphy
Hi: On Sat, Nov 5, 2011 at 11:06 PM, Kaiyin Zhong wrote: > Thank you Dennis, your tips are really helpful. > I don't quite understand the lm(y~mouse) part; my intention was -- in > pseudo code -- lm(y(Enzyme) ~ y(each elem)). As I said in my first response, I didn't quite understand what you wer

Re: [R] Correlation between matrices

2011-11-06 Thread Kaiyin Zhong
Thank you Dennis, your tips are really helpful. I don't quite understand the lm(y~mouse) part; my intention was -- in pseudo code -- lm(y(Enzyme) ~ y(each elem)). In addition, attach(d) seems necessary before using lm(y~mouse), and since d$mouse has a length 125, while each elem for each region ha

Re: [R] Correlation between matrices

2011-11-05 Thread Dennis Murphy
Hi: I don't think you want to keep these objects separate; it's better to combine everything into a data frame. Here's a variation of your example - the x variable ends up being a mouse, but you may have another variable that's more appropriate to plot so take this as a starting point. One plot us

[R] Correlation between matrices

2011-11-05 Thread Kaiyin Zhong
> regions = c('cortex', 'hippocampus', 'brain_stem', 'mid_brain', 'cerebellum') > mice = paste('mouse', 1:5, sep='') > for (n in c('Cu', 'Fe', 'Zn', 'Ca', 'Enzyme')) { + assign(n, as.data.frame(replicate(5, rnorm(5 + } > names(Cu) = names(Zn) = names(Fe) = names(Ca) = names(Enzyme) = regions

[R] correlation between matrices - both with some NAs

2008-07-29 Thread rcoder
Hi everyone, I'm having trouble applying the Cor() function to two matrices, both of which contain NAs. I am doing the following: a<-cor(m1, m2, use="complete.obs") ... and I get the following error message: Error in cor(m1, m2, use = "complete.obs") : no complete element pairs Does anyone