The tangram method is the principal method to create tables. It uses
R3 method dispatch. If one specifies rows and columns, one gets an empty
table of the given size. A formula or character will invoke the parser
and process the specified data into a table like Hmisc::summaryM
.
Given an rms
object it will summarize that model in a table. A
data.frame
is converted directly into a table as well for later
rendering. Can create tables from summary.rms(), anova.rms(), and other rms object info to create a
single pretty table of model results. The rms and Hmisc packages are required.
# S3 method for clmm2
tangram(
x,
id = NULL,
style = "hmisc",
caption = NULL,
footnote = NULL,
digits = NULL,
...
)# S3 method for summary.clmm2
tangram(
x,
id = NULL,
style = "hmisc",
caption = NULL,
footnote = NULL,
digits = NULL,
pformat = "%1.3f",
include_p = FALSE,
...
)
tangram(x, ...)
# S3 method for numeric
tangram(
x,
cols,
id = NULL,
caption = NULL,
style = "hmisc",
footnote = NULL,
fixed_thead = NULL,
...
)
# S3 method for anova.lme
tangram(
x,
id = NULL,
style = "hmisc",
caption = NULL,
footnote = NULL,
digits = NULL,
fixed_thead = NULL,
...
)
# S3 method for data.frame
tangram(
x,
id = NULL,
colheader = NA,
caption = NULL,
style = "hmisc",
footnote = NULL,
after = NA,
quant = seq(0, 1, 0.25),
msd = TRUE,
as.character = NULL,
fixed_thead = NULL,
exclude = NULL,
...
)
# S3 method for formula
tangram(
x,
data = NULL,
id = NULL,
transforms = NULL,
caption = NULL,
style = "hmisc",
footnote = NULL,
after = NA,
digits = NA,
fixed_thead = NULL,
exclude = NULL,
...
)
# S3 method for character
tangram(x, ...)
# S3 method for table
tangram(
x,
id = NULL,
percents = FALSE,
digits = 1,
test = FALSE,
footnote = NULL,
...
)
# S3 method for ftable
tangram(x, id = NULL, ...)
# S3 method for matrix
tangram(x, digits = NULL, ...)
# S3 method for tbl_df
tangram(x, ...)
# S3 method for lm
tangram(x, ...)
# S3 method for summary.lm
tangram(x, id = NULL, format = NULL, pformat = NULL, tformat = NULL, ...)
# S3 method for rms
tangram(
x,
data = NULL,
short.labels = NULL,
footnote = NULL,
rnd.digits = 2,
rnd.stats = rnd.digits,
...
)
A tangram object (a table).
object; depends on S3 type, could be rows, formula, string of a formula, data.frame or numerical rows, an rms.model
character; A unique charcter id used to identify this table over multiple runs. No spaces.
character; Desired rendering style, currently supports "hmisc", "nejm", and "lancet". Defaults to "hmisc"
character; A string with the desired caption
character; A vector of character strings as footnotes
numeric; default number of digits to use for display of numerics
addition models or data supplied to table construction routines
function or character; A function to format p values
logical; Include p-value when printing statistic
numeric; An integer of the number of cols to create
logical; On conversion to HTML5 should headers be treated as fixed?
character; Use as column headers in final table
function or list of functions; one or more functions to further process an abstract table
numeric; A vector of quantiles to use for summaries
logical; Include mean and standard deviation in numeric summary
logical; if true data.frames all variables are passed through as.character and no numerical summary is provided.
vector or list; When x is a data.frame this exclusion criteria is applied to the data. If this is a list then each list pair is the (column name, criteria). It is preferred to use a list to be specific.
data.frame; data to use for rendering tangram object
list of lists of functions; that contain the transformation to apply for summarization
logical; Display percents when rendering a table object. Defaults to FALSE
logical or function; Perform default test or a statistical function that will return a test result when passed a row and column
numeric or character; Format to apply to statistic
numeric or character; format to apply to t-value
numeric; Named vector of variable labels to replace in interaction rows. Must be in format c("variable name" = "shortened label").
numeric; Digits to round reference, comparison, result and CI values to. Defaults to 2.
numeric; Digits to round model LR, R2, etc to. Defaults to rnd.digits.
Note that additional arguments are passed to any subsequent transform. This means that a lot of possible arguments are not documented here but in the transform applied. Examine their documentations for additional possible arguments if needed.
Possible transforms are (see hmisc
) (*default*),
nejm
and lancet
.
tangram(1, 1)
tangram(data.frame(x=1:3, y=c('a','b','c')), id="mytbl1")
tangram(drug ~ bili + albumin + protime + sex + age + spiders, pbc, id="mytbl2")
tangram("drug~bili+albumin+stage::Categorical+protime+sex+age+spiders", pbc,"mytbl3")
Run the code above in your browser using DataLab