hello, can someone tell me how to generate the means for a data frame that looks like this? My data frame has many more variables, but I won't bother you with those; these are the one's that I'm interested in. Needless to say, z is the variable in which I'm interested. I'd like to find out the mean score of z for NDP managers, Conservative managers and Liberal managers and then for a few other configurations. Ive played around with aggregate, tapply and by, but I can't get it to work.
Cordially,
Simon Kiss
mydata=data.frame(cbind(x,y,z))
mydata$x=as.factor(sample(c("labourers", "salaried", "managers"), size=300, replace=TRUE)) mydata$y=as.factor(sample(c("NDP", "Green", "Liberal", "Conservative"), size=300, replace=TRUE))
mydata$z=as.numeric(sample(1:4, size=300, replace=TRUE))

*********************************
Simon J. Kiss, PhD
Assistant Professor, Wilfrid Laurier University
223 Grand River Hall, 171 Colborne Street
Brantford, Ontario, Canada
N3T 2C9
Cell: +1 519 761 7606

______________________________________________
R-help@r-project.org mailing list
https://stat.ethz.ch/mailman/listinfo/r-help
PLEASE do read the posting guide http://www.R-project.org/posting-guide.html
and provide commented, minimal, self-contained, reproducible code.

Reply via email to