Description Usage Arguments Details Author(s) Examples
SummaryTable automatically creates summary tables in latex format. The function calculates the frequency and percent(optional) of each level of each categorical row variable(rowvars) for each level of each column variable(colvars).
1 2 3 4 5 | SummaryTable(data,rowvars,colvar,row.names=NULL,cont.vars=NULL,percent=TRUE,output=c("latex","matrix"), reorder.columns=NULL,
cap=NULL,shortcap=NULL,lab=NULL,rnd.val=1,var.totals=FALSE,missing=TRUE,outfile="~/table1output.rtf",rtf.font.size=11,
col.widths=NULL, col.justify=('C'), header.col.justify=('C'),
rtf.row.names=FALSE, NA.string="-", space.before=NULL, space.after=NULL,
rmark.split=Inf)
|
data |
matrix or data frame with the row and column variables |
rowvars |
a character vector of quoted variable names or a numeric vector of categorical variables |
colvar |
a quoted variable name or a number identifying the column variable in the data |
row.names |
an optional character vector of row names if you want to change
the displayed name for row variables. |
cont.vars |
a character vector of variable names, or a number vector of column indices |
percent |
logical indicating whether to print percentages for each row |
output |
a vector of outputs including one or more of |
reorder.columns |
optional character string specifying the column level to appear first in the table |
cap |
character string with the desired table caption |
shortcap |
Character string with desired short caption to use in list of tables. |
lab |
character string with table label |
rnd.val |
number of digits to round to |
var.totals |
logical indicating whether to print totals for each row variable |
missing |
logical indicating whether to create a row within each row variable for NA values |
outfile |
if |
rtf.font.size |
if |
col.widths |
if |
col.justify |
if |
header.col.justify |
if |
rtf.row.names |
if |
NA.string |
if |
space.before |
if |
space.after |
if |
The core function of the table builder consists of repeated calls
to a tapply
statment:
table <- tapply(data$count, list(rowlist[[i]],data[ ,colvar]),sum)
where data$count is a function defined variable with a 1
in each
row for tabulating frequencies. rowlist[[i]]
represents each row variable
and data[ ,colvar]
is the column variable.
Currently the function does not support NA
values in the column variable.
Dominic LaRoche
1 2 3 | data(BDSSRecurrenceExample)
fr <- BDSSRecurrenceExample
SummaryTable(data=fr,rowvars=c("treated","trt2","single"),colvar="Recur",cont.vars=c("Age","meas"))
|
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.