[R] "contingency table" for several variables

2007-02-21 Thread David Meyer
David:

 >I ‘m trying to draw ONE table that summarize SEVERAL categorical 
 >variables
 >according to one classification variable, say “sex”. The result would 
 >look
 >like several contingency tables appended one to the other. All the 
 >variables
 >belong to a data frame.

 >The summary.formula in Hmisc package does something pretty close and is
 >ready for a Latex export  but I need either to get rid off the >percentage
 >(or put the count prior to the percentage )in the “reverse” option or 
 >to add
 >a chisquare test in the “response” method.


You could have a look at structable() in package vcd.


Best
David

__
R-help@stat.math.ethz.ch 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.


Re: [R] "contingency table" for several variables

2007-02-20 Thread Frank E Harrell Jr
David LEVY wrote:
> DearList,
> 
> 
> 
> I ‘m trying to draw ONE table that summarize SEVERAL categorical variables
> according to one classification variable, say “sex”. The result would look
> like several contingency tables appended one to the other. All the variables
> belong to a data frame.
> 
> The summary.formula in Hmisc package does something pretty close and is
> ready for a Latex export  but I need either to get rid off the percentage
> (or put the count prior to the percentage )in the “reverse” option or to add
> a chisquare test in the “response” method.

Not a good idea.  The % is normalized for sample size differences so 
should be emphasized.

Frank

> 
> 
> 
> The result would look like the one of
> 
>> summary(sex~treatment+Symptoms, fun = table, method = “response”)
> 
> in the help of  summary.formula but with chisquare tests attached.
> 
> Or :
> 
>> summary(sex~treatment+Symptoms, fun = table, method = “reverse”, test= T)
> 
>  gives all the information, but I can’t use it for its form is not
> appropriate.
> 
> 
> 
> Is there any package where I could find a solution ? Any way to create a
> function that would add a test in the “response” method ?
> 
> Otherwise, ftable should help but I don’t know how to use it with a
> data.frame.
> 
> 
> 
> Thanks for your help.
> 
> Regards,
> 
> David
> 
>   [[alternative HTML version deleted]]
> 
> 
> 
> 
> 
> __
> R-help@stat.math.ethz.ch 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.


-- 
Frank E Harrell Jr   Professor and Chair   School of Medicine
  Department of Biostatistics   Vanderbilt University

__
R-help@stat.math.ethz.ch 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.


[R] "contingency table" for several variables

2007-02-20 Thread David LEVY
DearList,



I ‘m trying to draw ONE table that summarize SEVERAL categorical variables
according to one classification variable, say “sex”. The result would look
like several contingency tables appended one to the other. All the variables
belong to a data frame.

The summary.formula in Hmisc package does something pretty close and is
ready for a Latex export  but I need either to get rid off the percentage
(or put the count prior to the percentage )in the “reverse” option or to add
a chisquare test in the “response” method.



The result would look like the one of

> summary(sex~treatment+Symptoms, fun = table, method = “response”)

in the help of  summary.formula but with chisquare tests attached.

Or :

> summary(sex~treatment+Symptoms, fun = table, method = “reverse”, test= T)

 gives all the information, but I can’t use it for its form is not
appropriate.



Is there any package where I could find a solution ? Any way to create a
function that would add a test in the “response” method ?

Otherwise, ftable should help but I don’t know how to use it with a
data.frame.



Thanks for your help.

Regards,

David

[[alternative HTML version deleted]]

__
R-help@stat.math.ethz.ch 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.