dt_to_load() takes a data.table, usually created from Idf$to_table() or IdfObject$to_table() with wide being TRUE, and format it into a data.table in acceptable format for $load() method in Idf class.

dt_to_load(dt, string_value = TRUE)

Arguments

dt

A data.table created using Idf$to_table() and IdfObject$to_table(). dt should at least contain column id (indicator used to distinguish object definitions), class (class names). If a name column exists, it will be preserved.

string_value

If TRUE, all value will be coerced into character and the value column of returned datat.table will be character type. If FALSE, the original value will be preserved and the value column of returned data.table will be list type.

Value

A data.table with 5 or 6 columns:

  • id: Integer type. Used to distinguish each object definition.

  • name: Character type. Only exists when input dt has a name column.

  • class: Character type.

  • index: Integer type. Field indices.

  • field: Character type. Field names.

  • value: Character or list type. The value of each field to be added.

Examples

if (FALSE) {
# read an example distributed with eplusr
path_idf <- system.file("extdata/1ZoneUncontrolled.idf", package = "eplusr")
idf <- read_idf(path_idf)

# extract all material object data and return it as a wide table
dt <- idf$to_table(class = "Material", wide = TRUE)

dt_to_load(dt)
}