This function lets you create an RDBES Data object in your current R environment.
Usage
createRDBESDataObject(
input = NULL,
listOfFileNames = NULL,
castToCorrectDataTypes = TRUE,
verbose = FALSE,
...
)Arguments
- input
Strings or
listobject. The path to the zip file downloaded from RDBES (or multiple zip files - see details), or path to a folder ofcsvfiles, or alistobject in the current environment containing data frames of each table. IfNULLan emptyRDBESDataObjectis created.- listOfFileNames
listof Strings, Optional. For use withcsvinputs only, and only required if the csv file names are not the default file names used by RDBES when downloading data (for instance if you created the files yourself). The actual file names should be alistof the two-letter code for the relevant table e.g.list("DE" = "DE.csv", "SD" = "SD.csv", etc.). If not used then it is assumed the files have the default file names used by the RDBES data download ("Design.csv" etc).- castToCorrectDataTypes
Logical. If
TRUEthen the function will attempt to cast the required columns to the correct data type. IfFALSEthen the column data types will be determined by how the csv files are read in. Default isTRUE.- verbose
(Optional) Set to TRUE if you want informative text printed out, or FALSE if you don't. The default is FALSE.
- ...
Additional parameters forwarded to helper functions used by this function. Most commonly these are forwarded to
validateRDBESDataObject()during the validation step. Common options:strict(logical, defaultTRUE): ifFALSE, validation issues result in warnings instead of stopping with an error.verbose(logical, defaultFALSE): request extra informational output from validation.Hierarchy(integer, e.g.1, optional; zip inputs only): when the zip file contains multiple hierarchies, selects which hierarchy to import. Note:checkDataTypesis controlled by thecastToCorrectDataTypesargument of this function and should not be supplied via....
Details
The input should be either:
A
zipfile downloaded from RDBES (or multiple zip files if you want to include or overwrite tables, for example CL and CE data). NOTE: Only the downloaded RDBES data with Table data format with ids is loaded by this function and not the uploaded format.A folder containing
csvfiles downloaded from RDBES (e.g. the unzipped file), or any set of csv files of the RDBES tables.A
listof data frames in the current environment representing different tables in the hierarchy.A
NULLinput will return and empty RDBES data object
ZIP file inputs
This input should be a path to a zip file downloaded from RDBES. Multiple
zip files can be entered if you want to include additional tables, for
example CL and CE. E.g. `input = c("path/to/H1.zip", "path/to/CL.zip"). If
any tables in the first input are overwritten by other inputs a warning is
given. You should not input different hierarchy files; this function will not
combine them.
If the zip contains multiple hierarchies (e.g., H1 and H5 within the same
archive), you can select which one to import by passing Hierarchy via
..., for example: Hierarchy = 1. If Hierarchy is not specified and the
zip contains multiple hierarchies, an error is raised prompting you to set it.
CSV file inputs
This input should be a path to a folder of csv files. These can be the
csv files downloaded from RDBES (e.g. an unzipped hierarchy), or any set
of csv files containing RDBES tables. If the files do not have the default
RDBES name (e.g. 'Design.csv') the listOfFileNames input can by used to
specify the file names e.g. list("DE" = "DE.csv", "SD" = "SD.csv", etc.).
List of data frames inputs
This input should be a list object containing data frames (or
data.tables) for each table in your hierarchy. They should be named with the
appropriate 2-letter code (DE, SD, etc.). Columns within these tables
will be renamed to the RDBES model documentation 'R name'. Note if you choose
to create an RDBESDAtaObject from local data frames these may have not
passed the data integrity checks performed when you upload to RDBES!
NULL inputs
This input produces an empty RDBESDataObject, i.e. all tables with
correct data classes but the tables will be empty.