Skip to contents

Used to convert nonstandard dose route values (i.e. "IV") to standard values ("intravascular").

Usage

apply_route_map(route_map = list(), route_col = NULL, DS = NULL)

Arguments

route_map

List with names corresponding to the route replacement and a vector of regular expressions to match.

route_col

Column name with the route data.

DS

Dataframe containing the dataset.

Value

Dataset with the route mapping applied.

Examples

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"]])
}
#> [1] "intravascular" "intravascular" "intravascular" "intravascular"
#> [5] "intravascular" "intravascular"