Online training class for Clinical R programming batch starts on Monday, 02Feb2026.
Click here for details.
library(tidyverse)
library(stringr)
library(purrr)
enrlment<-tribble(
~study,~pt,~icdt_raw,~enrldt_raw,~randdt_raw,
"CSG001","1001","1/JAN/2010","","",
"CSG001","1002","1/JAN/2010","4/JAN/2010","",
"CSG001","1003","1/JAN/2010","3/JAN/2010","3/JAN/2010",
"CSG001","1004","1/JAN/2010","4/JAN/2010","5/JAN/2010",
"CSG001","1005","15/JAN/2010","1/FEB/2010","5/FEB/2010",
"CSG001","1006","18/FEB/2010","1/MAR/2010","1/MAR/2010",
"CSG001","1007","4/APR/2010","14/APR/2010","14/APR/2010",
"CSG001","1008","20/JUN/2010","26/JUN/2010","27/JUN/2010",
)
enrl01<-enrlment %>%
mutate(across(c(icdt_raw, enrldt_raw, randdt_raw), ~ str_replace_all(., "/", " "))) enrlment <- data.frame(
study = c("CSG001", "CSG001", "CSG001", "CSG001", "CSG001", "CSG001", "CSG001", "CSG001"),
pt = c(1001, 1002, 1003, 1004, 1005, 1006, 1007, 1008),
icdt_raw = c("1/JAN/2010", "1/JAN/2010", "1/JAN/2010", "1/JAN/2010", "15/JAN/2010", "18/FEB/2010", "4/APR/2010", "20/JUN/2010"),
enrldt_raw = c("", "4/JAN/2010", "3/JAN/2010", "4/JAN/2010", "1/FEB/2010", "1/MAR/2010", "14/APR/2010", "26/JUN/2010"),
randdt_raw = c("", "", "3/JAN/2010", "5/JAN/2010", "5/FEB/2010", "1/MAR/2010", "14/APR/2010", "27/JUN/2010")
, stringsAsFactors = FALSE
)
enrl01 <- enrlment
cols <- c("icdt_raw", "enrldt_raw", "randdt_raw")
enrl01[cols] <- lapply(
enrl01[cols],
function(x) gsub("/", " ", x)
)