This function lets you create an RDBES Data object in your current R environment.

createRDBESDataObject(
  input = NULL,
  listOfFileNames = NULL,
  castToCorrectDataTypes = TRUE,
  ...
)

Arguments

input

Strings or list object. The path to the zip file downloaded from RDBES (or multiple zip files - see details), or path to a folder of csv files, or a list object in the current environment containing data frames of each table. If NULL an empty RDBESDataObject is created.

listOfFileNames

list of Strings, Optional. For use with csv inputs 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 a list of 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 TRUE then the function will attempt to cast the required columns to the correct data type. If FALSE then the column data types will be determined by how the csv files are read in. Default is TRUE.

...

parameters passed to validateRDBESDataObject if input is list of data frames e.g.strict=FALSE

Value

A RDBESDataObject

Details

The input should be either:

  • A zip file downloaded from RDBES (or multiple zip files if you want to include or overwrite tables, for example CL and CE data)

  • A folder containing csv files downloaded from RDBES (e.g. the unzipped file), or any set of csv files of the RDBES tables.

  • A list of data frames in the current environment representing different tables in the hierarchy.

  • A NULL input 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.

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.

Examples

myEmptyRDBESObject <- createRDBESDataObject(input = NULL)