library(dplyr)
filters <- function(anl,slref,filter_code){
vect_filter <- strsplit(filter_code, "_")[[1]]
title<-c()
for (filts in vect_filter) {
if (filts == "IT") {
anl <- anl %>% filter( ITTFL == "Y")
title <- c(title,"Intent-to-Treat Population")
}
if (filts == "SE") {
anl <- anl %>% filter(SAFFL == "Y")
title <- c(title,"Safety-Evaluable Population")
}
if (filts == "SER") {
slref <- slref %>% filter(AESER == "Y")
title <- c(title,"Serious Adverse Events")
}
if (filts == "INJ") {
slref <- slref %>% filter(AESCAT =='LOCAL INJECTION SITE REACTION' | AESCAT == 'SYSTEMIC INJECTION REACTION')
title <- c(title,"Injection Site Reactions")
}
if (filts == "INF") {
slref <- slref %>% filter(AESCAT == 'LOCAL INFUSION SITE REACTION' | AESCAT == 'SYSTEMIC INFUSION REACTION' )
title <- c(title,"Infusion Site Reactions")
}
if (filts == "REL") {
slref <- slref %>% filter(AEREL == "Y")
title <- c(title,"Related to Any Study Treatment")
}
if (filts == "DSCALL") {
slref <- slref %>% filter(AEACN1 == 'DRUG WITHDRAWN' | AEACN2 == 'DRUG WITHDRAWN' | AEACN3 == 'DRUG WITHDRAWN')
title <- c(title,"Leading to Study Treatment Discontinuation")
}
if (filts == "ATEZOSC") {
slref <- slref %>% filter(toupper(PARCAT2) == "ATEZOLIZUMAB SC" & toupper(PARCAT1) == "OVERALL")
title <- c(title,"Atezolizumab SC treatment")
}
if (filts == "RHUPH20") {
slref <- slref %>% filter(toupper(PARCAT2) == "RHUPH20" & toupper(PARCAT1) == "OVERALL")
title <- c(title,"RHUPH20 treatment")
}
if (filts == "ATEZOIV") {
slref <- slref %>% filter(toupper(PARCAT2) == "ATEZOLIZUMAB IV" & toupper(PARCAT1) == "OVERALL")
title <- c(title,"Atezolizumab IV treatment")
}
}
return(list(anl,slref,title ))
}
####Lopo as a SQL database ####
#con <- dbConnect(RSQLite::SQLite(), paste0("Studies/",study,"/meta/FILTERS"))
#dbCreateTable(con, "FILTERS", df_filter)
#dbAppendTable(con, "FILTERS", df_filter)
#dbReadTable(con, "FILTERS")
#dbDisconnect(con)
################################
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.