get_idf_table: Extract value data in a data.table

View source: R/impl-idf.R

get_idf_tableR Documentation

Extract value data in a data.table

Description

Extract value data in a data.table

Usage

get_idf_table(
  idd_env,
  idf_env,
  class = NULL,
  object = NULL,
  string_value = TRUE,
  unit = FALSE,
  wide = FALSE,
  align = FALSE,
  all = FALSE,
  group_ext = c("none", "group", "index"),
  force = FALSE,
  init = 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.

class

An integer vector of valid class indexes or a character vector of valid class names. Default: NULL.

object

An integer vector of valid object IDs or a character vector of valid object names. Default: NULL.

string_value

If TRUE, all field values are returned as character. If FALSE, value column in returned data.table is a list column with each value stored as corresponding type. Note that if the value of numeric field is set to "Autosize" or "Autocalculate", it is left as it is, leaving the returned type being a string instead of a number. Default: TRUE.

unit

Only applicable when string_value is FALSE. If TRUE, values of numeric fields are assigned with units using units::set_units() if applicable. Default: FALSE.

wide

Only applicable if target objects belong to a same class. If TRUE, a wide table will be returned, i.e. first three columns are always id, name and class, and then every field in a separate column. Note that this requires all objects specified must from the same class. Default: FALSE.

align

If TRUE, all objects in the same class will have the same field number. The number of fields is the same as the object that have the most fields among objects specified. Default: FALSE.

all

If TRUE, all available fields defined in IDD for the class that objects belong to will be returned. Default: FALSE.

group_ext

Should be one of "none", "group" or "index". If not "none", value column in returned data.table::data.table() will be converted into a list. If "group", values from extensible fields will be grouped by the extensible group they belong to. For example, coordinate values of each vertex in class BuildingSurface:Detailed will be put into a list. If "index", values from extensible fields will be grouped by the extensible field indice they belong to. For example, coordinate values of all x coordinates will be put into a list. If "none", nothing special will be done. Default: "none".

force

If TRUE, wide can be TRUE even though there are multiple classes in input. This can result in a data.table with lots of columns. But may be useful when you know that target classes have the exact same fields, e.g. Ceiling:Adiabatic and Floor:Adiabatic. Default: FALSE.

init

If TRUE, a table for new object input will be returned with all values filled with defaults. In this case, object input will be ignored. The id column will be filled with possible new object IDs. Default: FALSE.

Value

A data.table with 6 columns (if wide is FALSE) or at least 5 columns (if wide is TRUE).

When wide is FALSE, the 5 columns are:

  • id: Integer type. Object IDs.

  • name: Character type. Object names.

  • class: Character type. Current class name.

  • index: Integer type. Field indexes.

  • field: Character type. Field names.

  • value: Character type if string_value is TRUE or list type if string_value is FALSE or group_ext is not "none". Field values.


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