print_to_gt | R Documentation |
Print to gt
print_to_gt(tfrmt, .data, .unicode_ws = TRUE)
tfrmt |
tfrmt object that will dictate the structure of the table |
.data |
Data to style in order to make the table |
.unicode_ws |
Whether to convert white space to unicode in preparation for output |
a stylized gt object
library(dplyr) # Create tfrmt specification tfrmt_spec <- tfrmt( label = label, column = column, param = param, value=value, 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%)")))) )) # Create data df <- crossing(label = c("label 1", "label 2"), column = c("placebo", "trt1"), param = c("count", "percent")) %>% mutate(value=c(24,19,2400/48,1900/38,5,1,500/48,100/38)) print_to_gt(tfrmt_spec,df)
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.