R-Guru Smile design: how to one in SIlhouette Studio ยป Smart Silhouette Resource Hub

Learn to Apply R in the Regulatory Submission Process (Join Us)

Pharmaverse: Metadata > OAK > Admiral > Define.xml > TLGs (rtf/pdf) > Submissions > Shiny

 R Package

 

Metadata

Raw to SDTMs

(Sample Raw Data)

To ADaMs 

(Create Random ADaMs)

To Tables, Lists and Graphs 
 

R Scripts

(Tidyverse, DPLYR, etc.)

 N/A R Scripts  R Scripts 

R Scripts: Statistical Analysis

Tables & Lists, Graphs 

R Markdown

R Shiny

 

Pharmaverse

Blog

Metacore 

[ExamplesStructureFunctions]

Metatools

OAK [PresentationGithub]

SDTMChecks

[Example, FunctionsVideo 1, Video 2Github]

ADMIRAL 

[VideoStepsGithub]

rTables [TLGs

Tpylr


The pharmaceutical industy has quickly adapted to embrace R!  The Pharmaverse concept is created as a collaboration amoung top pharma and industy organizatins for open-source solutions.  Organizations now have the option to continue programming in R using common packages or use the packages from Pharmaverse to get a jump start.  With Pharmaverse R package compliance standards, organizations can feel more confident to apply these packages.  Smarter organizations make time to confirm packages behave as expected with expected results.  Up to 50% of Pharmaverse is built using Tidyverse.  This page is designed to help guide you using Pharmaverse packages.

Pharmaverse has R packages that work as modules to help in the CDISC submission process.  Organizations can plan to understand and start to incoporate R packages as needed to grow.  See new to clinical data and new to CDISC to learn about the basics.  Note that the SDTMs and ADaMs pages within R-Guru utilize base R and other non-Pharmaverse packages. 

  • # Metadata functions: is.character(), is.numeric, is.Date(), contents(), names(), rename(), label(), contains(), starts_with(), ends_with(), colnames(), nchar(), mode().  is.character, is.numeric and is.Date functions return TRUE or FALSE values.

    • print(contents(df), maxlevels=10, levelType='table') # requires hmisc package

    • names(adsl) <- tolower(names(adsl)) # lower case all variable names, toupper()

    • df <- df %>% rename(vr_new = vr_old) # rename variables

    • label(df$vr1) <- 'My Label' # assign variable labels
    • label(df[["vr1"]]) <- "My Label" # data frame options method

    • attr(data[["age"]], "label")  attr function to assign labels

    • df2 <- df1 %>% select(-contains('vr1')) # drop variables names that contain vr1

    • df <- select (vr1, vr10:vr15, starts_with("L")) # select vr1, vr10 to vr15 variables by order and variables that start with L, ends_with() 

    • intersect(names(df1), names(df2)) # list common variables between df1 and df2


    • setdiff(names(df1), names(df2)) # list of df1 unique variables that are not in df2

    • nms <- c(names(df1), names(df2)) # list of unique variable names from two or more data frames to compare
    • nms[duplicated(nms)] 

    • dt1 <- as.Date("2021/01/25")

    • log1 <- TRUE
    • mode(2) # numeric variable
    • mode('a') # character variable
    • mode(dt1) # numeric date variable
    • mode(log1) # logical variable

  • # SAS vs R Checking SDTM Compliance
  • # create exposure data
  • exposure <- data.frame(
  • USUBJID = c("1001", "1002", "1003", "1004"),
  • EXTRT = c("TreatmentA", "TreatmentB", "TreatmentA", "TreatmentC"),
  • EXDOSE = c(50, 100, 75, 25),
  • EXDOSU = c("mg", "mg", "mg", "IU"),
  • EXROUTE = c("Oral", "IV", "Topical", "Nasal"),
  • EXSTART = as.Date(c("2024-01-01", "2024-01-05", "2024-01-10", "2024-01-15")),
  • EXENDTC = as.POSIXct(c("2024-01-01 12:00:00", "2024-01-05 10:30:00", NA, "2024-01-15 12:30:00")),
  • EXDUR = c(2, 2, NA, 3),
  • EXDURU = c("days", "hours", NA, "hours"),
  • EXSTAT = c("Ongoing", "Completed", "Discontinued", "Ongoing")
  • )
  • # EX vars
  • ex_vars <- c("USUBJID", "EXTRT", "EXDOSE", "EXDOSU", "EXROUTE", "EXSTART", "EXENDTC", "EXDUR", "EXDURU", "EXSTAT")

  • # error counter variable
  • error_count <- 0

  • for (var in names(exposure)) {  # loop over all ex variable names
  • if (!(var %in% ex_vars)) { # check each ex var with list of ex_vars
  • cat("Error: Variable", var, "does not comply with SDTM EX naming standards.\n")
  • error_count <- error_count + 1
  • }
  • if (nchar(var) > 8) { # check each ex var for name length > 8
  • cat("Error: Variable", var, "length exceeds SDTM EX naming standards.\n")
  • error_count <- error_count + 1
  • }
  • }
  • if (error_count == 0) { # message for no or any errors
  • cat("All variables comply with SDTM EX naming standards.\n")
  • } else {
  • cat("Errors found in variable names in the data.\n")
  • } 

   

       

              

Powered by Wild Apricot Membership Software