RE: [R] Proportions again

2004-02-29 Thread Marc Schwartz
On Sun, 2004-02-29 at 19:26, Gabor Grothendieck wrote: > I agree its overkill but prop.table generalizes to mulitple > dimensions, in which case it becomes comparable to CrossTable, > so I thought it was worth mentioning. > > By the way, as the author of CrossTable, perhaps you > might might cons

RE: [R] Proportions again

2004-02-29 Thread Gabor Grothendieck
: Sun, 29 Feb 2004 19:19:29 -0600 From: Marc Schwartz <[EMAIL PROTECTED]> To: <[EMAIL PROTECTED]> Cc: <[EMAIL PROTECTED]>,R-Help <[EMAIL PROTECTED]> Subject: RE: [R] Proportions again On Sun, 2004-02-29 at 18:27, Gabor Grothendieck wrote: > That's tru

RE: [R] Proportions again

2004-02-29 Thread Marc Schwartz
On Sun, 2004-02-29 at 18:27, Gabor Grothendieck wrote: > That's true; however, > > CrossTable(x,x) > > does give the desired counts and proportions in the margin > line at the bottom. See the row labelled Column Total in > the following example based on Carlos' vector: > > > sex<-c(1,2,2,1,1,2

RE: [R] Proportions again

2004-02-29 Thread Gabor Grothendieck
0.375 | 0.625 | | -|---|---|---| --- Date: Sun, 29 Feb 2004 13:48:27 -0600 From: Marc Schwartz <[EMAIL PROTECTED]> To: <[EMAIL PROTECTED]> Cc: <[EMAIL PROTECTED]>,R-Help <[EMAIL PROTECTED]> Subject: RE: [R] Proportions again On Sun, 20

RE: [R] Proportions again

2004-02-29 Thread Marc Schwartz
On Sun, 2004-02-29 at 12:40, Gabor Grothendieck wrote: > Several people have alrady answered you by this time and > in addition to their answers you might also be interested > in CrossTable in package gregmisc. Gabor, Thanks for pointing out CrossTable(). Just as a quick heads up/clarification f

RE: [R] Proportions again

2004-02-29 Thread Gabor Grothendieck
ubject: [R] Proportions again 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:

RE: [R] Proportions again

2004-02-29 Thread John Fox
t; Sent: Sunday, February 29, 2004 9:35 AM > To: [EMAIL PROTECTED] > Subject: [R] Proportions again > > 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

Re: [R] Proportions again

2004-02-29 Thread Chuck Cleland
Carlos Mauricio Cardeal Mendes wrote: 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.

Re: [R] Proportions again

2004-02-29 Thread Peter Dalgaard
Andrew Robinson <[EMAIL PROTECTED]> writes: > table(sex)/length(sex) or, as is the intended usage: > prop.table(table(sex)) sex 1 2 0.375 0.625 > > 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<-

Re: [R] Proportions again

2004-02-29 Thread Andrew Robinson
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

[R] Proportions again

2004-02-29 Thread Carlos Mauricio Cardeal Mendes
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.153