rm(list=ls(all=TRUE))library(tinytex)library(ggplot2)library(plotly)library(dplyr)library(haven)library(labelled)library(bslib)library(DT)library(r2rtf)library(metalite)library(metalite.table1)library(haven)library(tidyr)library(tools)library(gtsummary)library(stringr)library(RColorBrewer)library(flextable)library(stringr)library(tern)library(tidyverse)library(vistime)library(readxl)library(hrbrthemes)library(rlang)library(lubridate) # For date calculationslibrary(haven)library(metalite)library(metalite.table1)
# Mean with CI, no stratification with group_varg_lineplot(adlb, variables =control_lineplot_vars(group_var =NA,x ="AVISIT",y ="AVAL"))
Code
# Mean, upper whisker of CI, no group_var(strata) counts Ng_lineplot( adlb,whiskers ="mean_ci_upr",title ="Plot of Mean and Upper 95% Confidence Limit by Visit")
Code
# Median with CIg_lineplot( adlb, adsl,mid ="median",interval ="median_ci",whiskers =c("median_ci_lwr", "median_ci_upr"),title ="Plot of Median and 95% Confidence Limits by Visit")
Code
# Mean, +/- SDg_lineplot(adlb, adsl,interval ="mean_sdi",whiskers =c("mean_sdi_lwr", "mean_sdi_upr"),title ="Plot of Median +/- SD by Visit")
Code
# Mean with CI plot with stats tableg_lineplot(adlb, adsl, table =c("n", "mean", "mean_ci"))
Code
# Mean with CI, table and customized confidence levelg_lineplot( adlb, adsl,table =c("n", "mean", "mean_ci"),control =control_analyze_vars(conf_level =0.80),title ="Plot of Mean and 80% Confidence Limits by Visit")
Code
# Mean with CI, table, filtered dataadlb_f <- dplyr::filter(adlb, ARMCD !="ARM A"| AVISIT =="BASELINE")g_lineplot(adlb_f, table =c("n", "mean"))
Citation
BibTeX citation:
@online{eric2024,
author = {Eric},
title = {CHG Line Plot},
date = {2024-05-24},
langid = {en}
}
For attribution, please cite this work as:
Eric. 2024. “CHG Line Plot.” Analysis. May 24, 2024.
Source Code
---title: "CHG line plot"subtitle: ""author: - name: Eric corresponding: true email: echen@ultragenyx.com roles: - Biostatistician - Project administration - Software - Visualization affiliations: - testkeywords: - tets - test - fracturedate: last-modifiedcitation: container-title: Analysisnumber-sections: trueformat: html: self-contained: true code-fold: true code-tools: true coddelink: true comments: hypothesis: true html-math-method: katex pdf: default docx: default jats: default # acs-pdf: default ipynb: defaultformat-links: [ipynb]toc: truetoc-depth: 5---```{r}#| label: load library#| warning: falserm(list=ls(all=TRUE))library(tinytex)library(ggplot2)library(plotly)library(dplyr)library(haven)library(labelled)library(bslib)library(DT)library(r2rtf)library(metalite)library(metalite.table1)library(haven)library(tidyr)library(tools)library(gtsummary)library(stringr)library(RColorBrewer)library(flextable)library(stringr)library(tern)library(tidyverse)library(vistime)library(readxl)library(hrbrthemes)library(rlang)library(lubridate) # For date calculationslibrary(haven)library(metalite)library(metalite.table1)``````{r}#| warning: falselibrary(tern)library(nestcolor)adsl <- tern_ex_adsladlb <- tern_ex_adlb %>% dplyr::filter(ANL01FL =="Y", PARAMCD =="ALT", AVISIT !="SCREENING")adlb$AVISIT <-droplevels(adlb$AVISIT)adlb <- dplyr::mutate(adlb, AVISIT = forcats::fct_reorder(AVISIT, AVISITN, min))# Mean with CIg_lineplot(adlb, adsl, subtitle ="Laboratory Test:")# Mean with CI, no stratification with group_varg_lineplot(adlb, variables =control_lineplot_vars(group_var =NA,x ="AVISIT",y ="AVAL"))# Mean, upper whisker of CI, no group_var(strata) counts Ng_lineplot( adlb,whiskers ="mean_ci_upr",title ="Plot of Mean and Upper 95% Confidence Limit by Visit")# Median with CIg_lineplot( adlb, adsl,mid ="median",interval ="median_ci",whiskers =c("median_ci_lwr", "median_ci_upr"),title ="Plot of Median and 95% Confidence Limits by Visit")# Mean, +/- SDg_lineplot(adlb, adsl,interval ="mean_sdi",whiskers =c("mean_sdi_lwr", "mean_sdi_upr"),title ="Plot of Median +/- SD by Visit")# Mean with CI plot with stats tableg_lineplot(adlb, adsl, table =c("n", "mean", "mean_ci"))# Mean with CI, table and customized confidence levelg_lineplot( adlb, adsl,table =c("n", "mean", "mean_ci"),control =control_analyze_vars(conf_level =0.80),title ="Plot of Mean and 80% Confidence Limits by Visit")# Mean with CI, table, filtered dataadlb_f <- dplyr::filter(adlb, ARMCD !="ARM A"| AVISIT =="BASELINE")g_lineplot(adlb_f, table =c("n", "mean"))```