expand_idf_dots_literal: Parse object values given in literal character vectors or...

View source: R/impl-idf.R

expand_idf_dots_literalR Documentation

Parse object values given in literal character vectors or data.frames

Description

Parse object values given in literal character vectors or data.frames

Usage

expand_idf_dots_literal(idd_env, idf_env, ..., .default = TRUE, .exact = FALSE)

Arguments

idd_env

An environment or list contains IDD tables including class, field, and reference.

idf_env

An environment or list contains IDF tables including object, value, and reference.

...

Character vectors or data.frames.

.default

If TRUE, all empty fields will be filled with default values if possible. Default: TRUE.

.exact

If TRUE, all inputs should match existing objects in the Idf. In this case, id column is require for data.frame input. Default: FALSE.

Details

For object definitions in character vector format, they follow the same rules as a normal IDF file:

  • Each object starts with a class name and a comma (⁠,⁠);

  • Separates each values with a comma (⁠,⁠);

  • Ends an object with a semicolon (⁠;⁠) for the last value.

Each character vector can contain:

  • One single object, e.g. c("Building,", "MyBuilding;"), or "Building, MyBuilding;".

  • Multiple objects, e.g. c("Building, MyBuilding;", "SimulationControl, Yes").

You can also provide an option header to indicate if input objects are presented in IP units, using ⁠!-Option ViewInIPunits⁠. If this header does not exist, then all values are treated as in SI units.

For object definitions in data.frame format, a valid definition requires at least three columns described below. Note that column order does not matter.

  • class:Character type. Valid class names in the underlying Idd object.

  • index:Integer type. Valid field indices for each class.

  • value:Character type or list type. Value for each field to be added.

    • If character type, each value should be given as a string even if the corresponding field is a numeric type.

    • If list type, each value should have the right type as the corresponding field definition.

  • id: Optional when .exact is FALSE. Integer type. If input data.frame includes multiple object definitions in a same class, values in id column will be used to distinguish each definition. If id column does not exists, it assumes that each definition is separated by class column and will issue an error if there is any duplication in the index column.

Value

A named list of 2 element object and value which is a data.table::data.table() with object data and value data respectively.

Note

Objects from character vectors will always be at the top of each table.


eplusr documentation built on Aug. 25, 2023, 5:18 p.m.