Skip to content

Conditional Correlation

2 messages · Mateus Rabello, Daniel Malter

#
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:
--
View this message in context: http://r.789695.n4.nabble.com/Conditional-Correlation-tp3607080p3607134.html
Sent from the R help mailing list archive at Nabble.com.