importRDBESDataDFS: Convert List of Data Frames to a RDBES Data Object

View source: R/importRDBESDataDFS.R

importRDBESDataDFSR Documentation

Convert List of Data Frames to a RDBES Data Object

Description

This function converts a list of data frames into an object of class RDBESDataObject.

Usage

importRDBESDataDFS(
  myList,
  castToCorrectDataTypes = TRUE,
  verbose = FALSE,
  strict = TRUE,
  addMissingColumns = FALSE,
  ...
)

Arguments

myList

A list of data tables. Each element of the list should be a data frame with an RDBES two-letter name (e.g. "DE").

castToCorrectDataTypes

logical. Indicates whether to cast the columns to the correct data types. Default is TRUE.

verbose

(Optional) Set to TRUE if you want informative text printed out, or FALSE if you don't. The default is FALSE.

strict

logical. Indicates level of validation of the RDBESDataObject it creates - should the validation be strict? Default is TRUE.

addMissingColumns

logical. Indicates whether to add missing columns

Details

Tables in the input list should have the correct 2-letter RDBES name (e.g. "DE", "LE", etc.). The function converts all data frames to data.table. NULL tables are left as NULL.

If castToCorrectDataTypes = TRUE, it ensures all columns are of the correct data type using setRDBESDataObjectDataTypes.

Column names are replaced with the RDBES 'R names' from the model documentation.

The function then sets a key on each table using the 'XXid' column as the key, where 'XX' is the name of that table. It also replaces all empty strings with NA.

It then uses the newRDBESDataObject function to create a new RDBESDataObject from the input.

Finally, it validates the RDBESDataObject using RDBEScore::validateRDBESDataObject and returns it.

Value

An RDBESDataObject with each element being a data table.


ices-tools-dev/icesRDBES documentation built on April 17, 2025, 1:58 p.m.