Skip to contents

savePlpData saves an object of type plpData to folder.

Usage

savePlpData(plpData, file, envir = NULL, overwrite = FALSE)

Arguments

plpData

An object of type plpData as generated using getPlpData.

file

The name of the folder where the data will be written. The folder should not yet exist.

envir

The environment for to evaluate variables when saving

overwrite

Whether to force overwrite an existing file

Value

Called for its side effect, the data will be written to a set of files in the folder specified by the user.

Examples

data("simulationProfile")
plpData <- simulatePlpData(simulationProfile, n = 500)
#> Generating covariates
#> Generating cohorts
#> Generating outcomes
saveLoc <- file.path(tempdir(), "savePlpData")
savePlpData(plpData, saveLoc)
dir(saveLoc, full.names = TRUE)
#> [1] "/tmp/RtmpPJeNgk/savePlpData/cohorts.rds" 
#> [2] "/tmp/RtmpPJeNgk/savePlpData/covariates"  
#> [3] "/tmp/RtmpPJeNgk/savePlpData/metaData.rds"
#> [4] "/tmp/RtmpPJeNgk/savePlpData/outcomes.rds"
#> [5] "/tmp/RtmpPJeNgk/savePlpData/timeRef.rds" 

# clean up
unlink(saveLoc, recursive = TRUE)