Important
THIS BRANCH IS FEATURE-FROZEN, AIMING FOR REPRODUCIBILITY IN 27TB ANALYSIS. ONLY BUG FIXES SHOULD BE ACCEPTED
This package provides a collection of useful R codes for data analysis from the Biostatistics group at OUCRU-HCM.
You can install C306 from github with:
# install.packages("devtools")
devtools::install_github("oucru-biostats/C306@feature-rbind")
These functions’ purpose are to generate report tables, outputting a
flextable or a intermediate object of class ss_table
for post-hoc
manipulation.
-
sstable.baseline
function to generate baseline table 1. -
sstable.survcomp
function to generate dual arm descriptive and inferential analysis for time-to-event outcome, supporting Cox pH and Restricted mean surival time models -
sstable.survcomp.subgroup
extendingsstable.survcomp
for subgroup analyses -
sstable.ae
function to generate adverse event tables with$\chi^2$ or Fisher test for comparision.
These function provides helper to create ss_table-esque output, with supporting function to convert them to flextable or huxtable.
ssformat
function to convert an arbitrary matrix to an sstabless_flextable
function to convert an sstable to a flextabless_huxtable
function to convert an sstable to a huxtableft_sstheme
function to decorate an arbitrary flextable to have an sstable-esque themeht_theme_markdown
andht_theme_kable
functions to decorate huxtable to follow a sstable-esque themeas_sstable
converting objects to sstable
gg_boxcox
same withMASS::boxcox
but in ggplotggsurvfit2
same asggsurvfit::ggsurvfit
but with strata separated. Note that it relies ontidy_survfit2
and does not work withggsurvfit::survfit2
at the moment.gg_ajsurvplot
plots one Aalen-Johansen curve for competing risks for the event of interest. Note that this is based onsurviminer
due to its flexibilitygg_ajsurvplot2
plots two Aalen-Johansen curves for main risk (from bottom) and competing risk (from top). Note that this is basedggsurvfit
with some limitations. However, it has the ability to return a dataset for more flexibility in plotting with ggplot.
import.info
andconvert.info
import and convert OUCRU dictionary to C306 style dict to use for data inspectioninsepct.data
function to check data for error based on a dictionary byconvert.info
myformat.data
function to reformat the data to readable form base on the dictionary byconvert.info
labAE
function to determine a laboratory AE based on a threshold
logist_summary
based on a function by OUCRU Biostats group, reporting the OR of logistic regressionsubgroup_effect
extendslogist_summary
to report the subgroup OR of variables that have interaction with a common covariate (i.e. treatment arm).mutate_f
andsummarise_f
perform multiple assignment for data.frame byc(a,b):=list(v_a, v_b)
simple_relevel
relevels a factor correposnding to the level of another factorsimple_recode
pattern-based recoding of data by in-place replacementtidy_survfit2
same as but with strata saved for easier plotting. Note that it, at the moment, does not work withggsurvfit::survfit2
ironically.