get_rc_fld_vals: Get field values in an RC object with optional replacement

Description Usage Arguments Details Value Examples

View source: R/rc_utils.R

Description

Retrieves a list of field values from an RC object, replacing any existing values with those supplied.

Usage

1
get_rc_fld_vals(rc_obj, vals = NULL)

Arguments

rc_obj

An RC object.

vals

list: Fields to replace in rc_obj.

Details

Adapted from http://stackoverflow.com/questions/18713847/return-a-list-of-fields-of-a-reference-class

Value

list: Existing fields in rc_obj with values replaced by any values supplied in vals.

Examples

1
2
3
4
5
6
  thing_factory <- setRefClass(
    "thing", fields = list(name  = "character", value = "numeric")
  )
  flibgib <- thing_factory$new(name = "Flibberty Gibbet", value = 1e6)
  get_rc_fld_vals(flibgib)
  get_rc_fld_vals(flibgib, list(value = 25.6))

toniprice/jute documentation built on May 21, 2017, 6:31 a.m.