Re: [R] Within-group correlation confidence intervals

2009-09-20 Thread David Freedman
you should save your 3 variables into a new *dataframe* d<-mydata[,c("iq","education","achievement")] and then the command would be by(d,d$sex,function(df) cor.test(df$educ,df$achiev)) but you could also just use by(mydata,mydata$sex,function(df) cor.test(df$educ,df$achiev)) david freedman

[R] Within-group correlation confidence intervals

2009-09-18 Thread jlwoodard
I'm trying to obtain within-group correlations on a subset of variables. I first selected my variables using the following command: mydata$x<-mydata[c("iq","education","achievement")] I'd like to look at correlations among those variables separately for men and women. My gender variable in mydata