rename_per_field() renames all objects in specified class in format class-field, where class and field are character vectors created by using class names and class_fun, and field values and field_fun, respectivly.

rename_per_field(
  idf,
  class,
  field,
  class_fun = function(x) abbreviate(x, 10L),
  field_fun = NULL,
  strict = FALSE
)

Arguments

idf

An eplusr::Idf

class

A character vector of classes names

field

An integer or a single string specifying the fields whose values will be used as input passed to field_fun

class_fun, field_fun

A function to take the corresponding class names or field values as input, process them and return a character vector with the same length. It can also be a named character vector. In this case, when specified class names or field values match element value, the element name will be used as part of the new name. If NULL, the class names or field values will be directly used. For class_fun, default is to use base::abbreviate() to abbreviate them into 10 character width. For field_fun, default is NULL.

strict

If TRUE, an error will be issued if the newly generated object names contain duplications. If FALSE, make.unique will be called to make sure there are no duplications. Default: FALSE

Value

The modified eplusr::Idf object itself, invisiblly