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.baselinefunction to generate baseline table 1. -
sstable.survcompfunction to generate dual arm descriptive and inferential analysis for time-to-event outcome, supporting Cox pH and Restricted mean surival time models -
sstable.survcomp.subgroupextendingsstable.survcompfor subgroup analyses -
sstable.aefunction 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.
ssformatfunction to convert an arbitrary matrix to an sstabless_flextablefunction to convert an sstable to a flextabless_huxtablefunction to convert an sstable to a huxtableft_ssthemefunction to decorate an arbitrary flextable to have an sstable-esque themeht_theme_markdownandht_theme_kablefunctions to decorate huxtable to follow a sstable-esque themeas_sstableconverting objects to sstable
gg_boxcoxsame withMASS::boxcoxbut in ggplotggsurvfit2same asggsurvfit::ggsurvfitbut with strata separated. Note that it relies ontidy_survfit2and does not work withggsurvfit::survfit2at the moment.gg_ajsurvplotplots one Aalen-Johansen curve for competing risks for the event of interest. Note that this is based onsurviminerdue to its flexibilitygg_ajsurvplot2plots two Aalen-Johansen curves for main risk (from bottom) and competing risk (from top). Note that this is basedggsurvfitwith some limitations. However, it has the ability to return a dataset for more flexibility in plotting with ggplot.
import.infoandconvert.infoimport and convert OUCRU dictionary to C306 style dict to use for data inspectioninsepct.datafunction to check data for error based on a dictionary byconvert.infomyformat.datafunction to reformat the data to readable form base on the dictionary byconvert.infolabAEfunction to determine a laboratory AE based on a threshold
logist_summarybased on a function by OUCRU Biostats group, reporting the OR of logistic regressionsubgroup_effectextendslogist_summaryto report the subgroup OR of variables that have interaction with a common covariate (i.e. treatment arm).mutate_fandsummarise_fperform multiple assignment for data.frame byc(a,b):=list(v_a, v_b)simple_relevelrelevels a factor correposnding to the level of another factorsimple_recodepattern-based recoding of data by in-place replacementtidy_survfit2same as but with strata saved for easier plotting. Note that it, at the moment, does not work withggsurvfit::survfit2ironically.