You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
The goal of reportRmd is to automate the reporting of clinical data in
Rmarkdown environments. Functions include table one-style summary
statistics, compilation of multiple univariate models, tidy output of
multivariable models and side by side comparisons of univariate and
multivariable models. Plotting functions include customisable survival
curves, forest plots, and automated bivariate plots.
Installation
Installing from CRAN:
install.packages('reportRmd')
You can install the development version of reportRmd from
GitHub with:
var_names<-data.frame(var=c("age","pdl1","change_ctdna_group"),
label=c('Age at study entry',
'PD L1 percent',
'ctDNA change from baseline to cycle 3'))
pembrolizumab<- set_labels(pembrolizumab,var_names)
rm_covsum(data=pembrolizumab, maincov='sex',
covs=c('age','pdl1','change_ctdna_group'))
Full Sample (n=94)
Female (n=58)
Male (n=36)
p-value
Age at study entry
0.30
Mean (sd)
57.9 (12.8)
56.9 (12.6)
59.3 (13.1)
Median (Min,Max)
59.1 (21.1, 81.8)
56.6 (34.1, 78.2)
61.2 (21.1, 81.8)
PD L1 percent
0.76
Mean (sd)
13.9 (29.2)
15.0 (30.5)
12.1 (27.3)
Median (Min,Max)
0 (0, 100)
0.5 (0.0, 100.0)
0 (0, 100)
Missing
1
0
1
ctDNA change from baseline to cycle
3
0.84
Decrease from baseline
33 (45)
19 (48)
14 (42)
Increase from baseline
40 (55)
21 (52)
19 (58)
Missing
21
18
3
Multiple Univariate Regression Analyses
rm_uvsum(data=pembrolizumab, response='orr',
covs=c('age','pdl1','change_ctdna_group'))
#> Waiting for profiling to be done...#> Waiting for profiling to be done...#> Waiting for profiling to be done...
uvsumTable<- rm_uvsum(data=pembrolizumab, response='orr',
covs=c('age','sex','pdl1','change_ctdna_group'),tableOnly=TRUE)
#> Waiting for profiling to be done...#> Waiting for profiling to be done...#> Waiting for profiling to be done...#> Waiting for profiling to be done...glm_fit<- glm(orr~change_ctdna_group+pdl1,
family='binomial',
data=pembrolizumab)
mvsumTable<- rm_mvsum(glm_fit,tableOnly=TRUE)
rm_uv_mv(uvsumTable,mvsumTable)
Unadjusted OR(95%CI)
p
Adjusted OR(95%CI)
p (adj)
Age at study entry
0.96 (0.91, 1.00)
0.089
sex
0.11
Female
Reference
Male
0.41 (0.13, 1.22)
PD L1 percent
0.97 (0.95, 0.98)
\<0.001
0.98 (0.96, 1.00)
0.024
ctDNA change from baseline to cycle
3
0.002
0.004
Decrease from baseline
Reference
Reference
Increase from baseline
28.74 (5.20, 540.18)
24.71 (2.87, 212.70)
Simple survival summary table
Shows events, median survival, survival rates at different times and the
log rank test. Does not allow for covariates or strata, just simple
tests between groups
library(survival)
data(pbc)
rm_cifsum(data=pbc,time='time',status='status',group=c('trt','sex'),
eventtimes=c(1825,3650),eventtimeunit='day')
#> 106 observations with missing data were removed.
require(ggplot2)
#> Loading required package: ggplot2
forestplotMV(glm_fit)
#> Warning in forestplotMV(glm_fit): NAs introduced by coercion
Plotting bivariate relationships
These plots are designed for quick inspection of many variables, not for
publication.
require(ggplot2)
plotuv(data=pembrolizumab, response='orr',
covs=c('age','cohort','pdl1','change_ctdna_group'))
#> Boxplots not shown for categories with fewer than 20 observations.#> Boxplots not shown for categories with fewer than 20 observations.
Replacing variable names with labels in ggplot
data("mtcars")
mtcars<-mtcars|>dplyr::mutate(cyl= as.factor(cyl)) |>
set_labels(data.frame(var=c("hp","mpg","cyl"),
label=c('Horsepower',
'Miles per gallon',
'Number of cylinders')))
p<-mtcars|>
ggplot(aes(x=hp, y=mpg, color=cyl, shape=cyl)) +
geom_point()
replace_plot_labels(p)