extractDatabaseToCsv | R Documentation |
Exports all the results from a database into csv files
extractDatabaseToCsv(
conn = NULL,
connectionDetails,
databaseSchemaSettings = createDatabaseSchemaSettings(resultSchema = "main"),
csvFolder,
minCellCount = 5,
sensitiveColumns = getPlpSensitiveColumns(),
fileAppend = NULL
)
conn |
The connection to the database with the results |
connectionDetails |
The connectionDetails for the result database |
databaseSchemaSettings |
The result database schema settings |
csvFolder |
Location to save the csv files |
minCellCount |
The min value to show in cells that are sensitive (values less than this value will be replaced with -1) |
sensitiveColumns |
A named list (name of table columns belong to) with a list of columns to apply the minCellCount to. |
fileAppend |
If set to a string this will be appended to the start of the csv file names |
Extracts the results from a database into a set of csv files
The directory path where the results were saved
# develop a simple model on simulated data
data("simulationProfile")
plpData <- simulatePlpData(simulationProfile, n = 500)
saveLoc <- file.path(tempdir(), "extractDatabaseToCsv")
results <- runPlp(plpData, outcomeId = 3, saveDirectory = saveLoc)
# now upload the results to a sqlite database
databasePath <- insertResultsToSqlite(saveLoc)
# now extract the results to csv
connectionDetails <-
DatabaseConnector::createConnectionDetails(dbms = "sqlite",
server = databasePath)
extractDatabaseToCsv(
connectionDetails = connectionDetails,
csvFolder = file.path(saveLoc, "csv")
)
# show csv file
list.files(file.path(saveLoc, "csv"))
# clean up
unlink(saveLoc, recursive = TRUE)
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.