Description Usage Arguments Details Value Author(s) See Also Examples
groupSummary
summarize continuous variables by providing means and sample standard deviations
and categorical variables by giving numbers and percentages for each group.
1 | groupSummary(data, group = NULL, digits = 3)
|
data |
a data frame contains the variables |
group |
a character string specify the grouping variable (default NULL) |
digits |
the specified number of decimal places (default 3) |
This function summarize continuous variables by providing means and sample standard deviations
and categorical variables by giving numbers and percentages for each group.
Missing values (NA) will be stripped before the computation proceeds.
If you do not specify group
, this function will summarize the variables for total group only.
Return a data frame containing (1) means and/or numbers, (2) sample standard deviations and/or percentages, (3) numbers of available data for total and each group.
Yasuyuki Okumura
Department of Social Psychiatry,
National Institute of Mental Health,
National Center of Neurology and Psychiatry
yokumura@blue.zero.jp
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 | data(infert)
infert$case <- factor(infert$case, labels=c("control", "case"))
infert$induced <- factor(infert$induced, labels=c("0","1","2 or more"))
infert$spontaneous <- factor(infert$spontaneous, labels=c("0","1","2 or more"))
#continuous and categorical variables
groupSummary(infert, group="case")
#continuous variables only
groupSummary(infert[, c(2,3,7,8, 5)], group="case")
#categorical variables only
groupSummary(infert[, c(1,4, 6, 5)], group="case")
#total sample
groupSummary(infert[, c(1,4, 6, 5)])
|
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.