Learn R Programming

Infusion (version 2.1.0)

get_from: Backward-compatible extractor from summary-likelihood objects

Description

A generic function, whose default method works for list, and with specific methods for objects inheriting from classes SLik_j and SLik.

Usage

get_from(object, which, ...)

## S3 methods with additional argument(s) # S3 method for SLik get_from(object, which, raw=FALSE, force=FALSE, ...) # S3 method for SLik_j get_from(object, which, raw=FALSE, force=FALSE, ...)

Value

Will depend on which, but aims to retain a convenient format backward compatible with version 1.4.0.

Arguments

object

Any object with a list structure.

which

Character: names of element to be extracted.

raw

Boolean: if TRUE, object[[which]] is returned, without any particular check of its value. By default, raw is FALSE and various operations may be performed on the extracted value (see “example” below), including optional recomputation if force is TRUE.

force

Boolean: if TRUE, the extracted element may be computed if it appears to be missing from the object. This is notably so for which="RMSEs" or which="par_RMSEs"; in these cases, the results of the computation are further saved in the original object.

...

further arguments passed to or from other methods (currently not used).

See Also

Examples

Run this code
  # # 0bserved summary statistics 
  # #  (projected, with raw ones as attribute, if relevant)
  #   get_from(slik, "obs") 
  # 
  # # On any summary-likelihood object 'slik':
  #   get_from(slik, which="par_RMSEs") # matrix
  # # despite $par_RMSEs being an environment if 
  # #  'slik' was created by version > 1.4.0, as then shown by
  #   get_from(slik, which="par_RMSEs", raw=TRUE)
  #
  # # Further, if 
  #   get_from(slik, which="par_RMSEs")
  # # returns NULL because the element is absent from the object, 
  # # then one can force its computation by 
  #   get_from(slik, which="par_RMSEs", force=TRUE)
  # # The result are saved in the 'slik' object, so running again 
  #   get_from(slik, which="par_RMSEs")
  # # will no longer return NULL.

Run the code above in your browser using DataLab