This question was just answered yesterday in this post:
http://r.789695.n4.nabble.com/Correlations-by-subgroups-td3599548.html#a3600553
One solution:
x<-c(1,1,1,1,1,2,2,2,2,2)
y<-rnorm(10)
z<-y+rnorm(10)
by(data.frame(y,z),factor(x),cor)
HTH,
Daniel
Mateus Rabello wrote:
>
> Hi,
> How c
Hi,
How can I accomplish this in R. Example:
I have the following data.frame:
data <-
data.frame(x=c(1,2,3,4,5,6,5,3,7,1,0,4,8),y=c(1,2,1,2,2,2,1,1,1,2,2,2,2),z=c(5,8,4,3,4,1,6,3,3,6,3,5,7))
Supposing that data$y is a factor, I would like to find the Spearman
correlation between data$x and
2 matches
Mail list logo