Skip to content

how to make a table of summary statistics

3 messages · Francesco Sarracino, Duncan Murdoch, Jim Lemon

#
On 12-12-20 6:45 AM, Francesco Sarracino wrote:
I'm not sure what you want for var3:  it doesn't make sense to calculate 
the mean or sd for a factor.  But for the other variables, using package 
tables, you  do

latex( tabular( Heading("variable")*(var1 + var2) ~ (mean + sd + min + 
max + (obs=length) + (missing=function(x) sum(is.na(x)))), data=data) )

You might want a breakdown of the summaries by var3; you'd get that this 
way:

latex( tabular( Heading("variable")*(var1 + var2)*var3 ~ (mean + sd + 
min + max + (obs=length) + (missing=function(x) sum(is.na(x)))), 
data=data) )

Duncan Murdoch
#
On 12/20/2012 10:45 PM, Francesco Sarracino wrote:
Hi Francesco,
Have a look at the describe function (prettyR) that allows you to select 
the summary statistics you want for numeric variables and automatically 
produces count statistics for factor, character and logical variables. 
There are also other "auto-summarize" functions in packages such as 
psych and Hmisc.

Jim