if(system.file(package="readxl") !=""){
library(readxl)
#loading a dataset
data_file = system.file(package="formods","test_data","TEST_DATA.xlsx")
myDS = readxl::read_excel(path=data_file, sheet="DATA")
route_map = list(
intravascular = c("^(?i)iv$"),
extravascular = c("^(?i)sc$", "^(?i)oral")
)
utils::head(myDS[["ROUTE"]])
myDS = apply_route_map(route_map = route_map,
route_col = "ROUTE",
DS = myDS)
utils::head(myDS[["ROUTE"]])
}
Run the code above in your browser using DataLab