| print_mock_gt {tfrmt} | R Documentation |
Print mock table to GT
Description
Print mock table to GT
Usage
print_mock_gt(
tfrmt,
.data = NULL,
.default = 1:3,
n_cols = NULL,
.unicode_ws = TRUE
)
Arguments
tfrmt |
tfrmt the mock table will be based off of |
.data |
Optional data. If this is missing, group values, labels values and parameter values will be estimated based on the tfrmt |
.default |
sequence to replace the default values if a dataset isn't provided |
n_cols |
the number of columns. This will only be used if mock data isn't
provided. If not supplied, it will default to using the |
.unicode_ws |
Whether to convert white space to unicode in preparation for output |
Value
a stylized gt object
Examples
# Create tfrmt specification
tfrmt_spec <- tfrmt( label = label, column =
column, param = param, body_plan = body_plan( frmt_structure(group_val =
".default", label_val = ".default", frmt_combine( "{count} {percent}",
count = frmt("xxx"), percent = frmt_when("==100"~ frmt(""), "==0"~ "",
"TRUE" ~ frmt("(xx.x%)")))) ))
# Print mock table using default
print_mock_gt(tfrmt = tfrmt_spec)
# Create mock data
df <- crossing(label = c("label 1", "label 2",
"label 3"), column = c("placebo", "trt1", "trt2"), param = c("count",
"percent"))
# Print mock table using mock data
print_mock_gt(tfrmt_spec, df)
[Package tfrmt version 0.1.2 Index]