Proportions again
table(sex)/length(sex) Andrew
On Sunday 29 February 2004 06:35, Carlos Mauricio Cardeal Mendes wrote:
Hello. I asked before and it was great, cause as a beginner I learned a lot. But,
if I have this in R (1 and 2 are codes for sex):
sex<-c(1,2,2,1,1,2,2,2) sex
[1] 1 2 2 1 1 2 2 2 I?d like to obtain the proportion according to sex.So I type:
prop.table(sex)
[1] 0.07692308 0.15384615 0.15384615 0.07692308 0.07692308 0.15384615
0.15384615 [8] 0.15384615
The result is OK, but I expected to see a simple frequency table or
something like that:
1 0.375
2 0.625
1.0
How can I get this ?
Thank you very much
[[alternative HTML version deleted]]
______________________________________________ R-help at stat.math.ethz.ch mailing list https://www.stat.math.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide! http://www.R-project.org/posting-guide.html
Andrew Robinson Ph: 208 885 7115 Department of Forest Resources Fa: 208 885 6226 University of Idaho E : andrewr at uidaho.edu PO Box 441133 W : http://www.uidaho.edu/~andrewr Moscow ID 83843 Or: http://www.biometrics.uidaho.edu No statement above necessarily represents my employer's opinion.