Flexibly generate output tables based on a data frame and derived statistical quantities
IQRtable.Rd
The function allows to define a table composed of user-define output columns being specified by strings and keywords.
IQRtable(data, stat, ...)
Arguments
Value
Character matrix with one column for each argument in ...
. The first element in a column is always the
name of the argument name in ...
(header), the other elements correspond to the formatted values.
For exporting use as.data.frame.IQRtable before IQRoutputTable
Details
Keywords in the strings in ...
are replaced by values provided by stat
or found in data
. First, all statistical key words are replaced (see statSE and statCI
for a list
of keywords). Second, the employed column names of data
are replace by the data values. All non-recognized
symbols/words are returned as they are.
Keywords can be composed to flexibly control the output format. For example value (rse%)
could return
1.36 (18.5%)
for a value of 1.3564
and a standard error of 0.25123
.
See also
Other IQR Table:
as.data.frame.IQRtable()
,
as_IQRtable()
,
cjoin_IQRtable()
,
composeByRule_IQRtable()
,
compose_IQRtable()
Examples
if (FALSE) { # \dontrun{
mydata <- data.frame(
parameter = c("A", "B"),
value = c(pi, pi),
lower = c(1.5214, -Inf),
upper = c(37.4831, 4.27134),
se = c(0.082723, 0.57)
)
as_IQRtable(mydata)
mytable <- IQRtable(
data = mydata,
stat = statSE(value, se),
# Output
`Parameter` = "parameter",
`Value` = "value",
`CI [95%]` = "[lower.95, upper.95]",
`RSE [%]` = "rse%",
`Value + 68% CI` = "value + [lower.68, upper.68]",
`Value (RSE)` = "value (rse%)"
)
print(mytable)
# To export the table, convert to data frame and use IQRoutputTable()
# IQRoutputTable(as.data.frame(mytable), filename = "mytable.txt")
mytable <- IQRtable(
data = mydata,
stat = statCI(value, lower, upper, CL = 0.68),
# Output
`Parameter` = "parameter",
`Value` = "value",
`CI [95%]` = "[lower.95, upper.95]",
`RSE [%]` = "rse%",
`Value + 68% CI` = "value + [lower.68, upper.68]",
`Value (RSE)` = "value (rse%)"
)
print(mytable)
} # }