knitr::opts_chunk$set( collapse = TRUE, comment = "." )
We can re-name the various column names in the output table
We make a named list with re-names for each column we are summarizing or paneling by.
table <- list(WT = "weight", BMI = "body mass index", SCR = "serum creatinine")
Here we created the list manually; you can also pull this information out of the data specification object.
We pass this table list into the continuous covariate table function
library(pmtables) library(dplyr) data <- pmtables:::data("id") pt_cont_long( data, cols = "BMI,SCR,WT", table = table )
Rather than creating that list of renames, we can re-name in line using the vars constructor
pt_cat_wide( data, cols = vars(Sex = SEXf, Formaulation = FORMf), by = vars("Study ID" = STUDYf) )
We can also rename the panel
or by
variable
obs <- pmtables:::data("obs") pt_data_inventory( obs, by = vars(Sex = SEXf), panel = vars(Formulation = FORMf) )
Remember, you are on the hook to label or relabel your factors
data2 <- mutate( data, SEXf = factor(SEXf, labels = c("dude", "gal"))) pt_cat_wide( data2, cols = vars(Sex = SEXf, Formulation = FORMf), by = vars("Study ID" = STUDYf) )
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.