knitr::opts_chunk$set( collapse = TRUE, comment = "#>", fig.path = "README-" )
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 modelssstable.survcomp.subgroup
extending sstable.survcomp
for subgroup analysessstable.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
and ht_theme_kable
functions to decorate huxtable to follow a sstable-esque themeas_sstable
converting objects to sstablegg_boxcox
same with MASS::boxcox
but in ggplotggsurvfit2
same as ggsurvfit::ggsurvfit
but with strata separated. Note that it relies on tidy_survfit2
and does not work with ggsurvfit::survfit2
at the moment.gg_ajsurvplot
plots one Aalen-Johansen curve for competing risks for the event of interest. Note that this is based on surviminer
due to its flexibilitygg_ajsurvplot2
plots two Aalen-Johansen curves for main risk (from bottom) and competing risk (from top). Note that this is based ggsurvfit
with some limitations. However, it has the ability to return a dataset for more flexibility in plotting with ggplot.import.info
and convert.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 by convert.info
myformat.data
function to reformat the data to readable form base on the dictionary by convert.info
labAE
function to determine a laboratory AE based on a thresholdlogist_summary
based on a function by OUCRU Biostats group, reporting the OR of logistic regressionsubgroup_effect
extends logist_summary
to report the subgroup OR of variables that have interaction with a common covariate (i.e. treatment arm).mutate_f
and summarise_f
perform multiple assignment for data.frame by c(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 \code{\link[ggsurvfit:tidy_survfit]{ggsurvfit:tidy_survfit}} but with strata saved for easier plotting. Note that it, at the moment, does not work with ggsurvfit::survfit2
ironically.Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.