Get a single value from a Rxs tree, list of trees, or full Rxs project object

get_singleValue_fromTree(
  x,
  entityId,
  lookInValueLists = TRUE,
  returnDf = FALSE,
  flattenVectorsInDf = TRUE,
  pathString_regex_flatten = NULL,
  pathString_regex_explode = NULL,
  fieldname_regex_alwaysFlatten = NULL,
  returnLongDf = TRUE,
  pathString_regex_select = ".*",
  silent = metabefor::opts$get("silent")
)

get_singleValue_fromTreeList(
  x,
  entityId,
  returnDf = TRUE,
  nullValue = 0,
  naValue = NULL,
  lookInValueLists = TRUE,
  flattenVectorsInDf = TRUE,
  warningValues = list(NULL, NA),
  warningFunctions = NULL,
  pathString_regex_select = ".*",
  pathString_regex_flatten = NULL,
  pathString_regex_explode = NULL,
  fieldname_regex_alwaysFlatten = NULL,
  returnLongDf = TRUE,
  silent = metabefor::opts$get("silent")
)

get_singleValue(
  x,
  entityId,
  returnDf = TRUE,
  flattenVectorsInDf = TRUE,
  returnLongDf = TRUE,
  lookInValueLists = TRUE,
  pathString_regex_select = ".*",
  pathString_regex_flatten = NULL,
  pathString_regex_explode = NULL,
  fieldname_regex_alwaysFlatten = NULL,
  silent = metabefor::opts$get("silent")
)

Arguments

x

The tree, tree list, or full Rxs project object.

entityId

The entity identifier of the value to get

lookInValueLists

Whether to also look inside value lists

returnDf

Whether to return a data frame or not

flattenVectorsInDf

The default action to apply for values not matching one of pathString_regex_flatten and pathString_regex_explode: to flatten by default, pass TRUE; to explode by default, pass FALSE.

pathString_regex_flatten, pathString_regex_explode

Regular expressions matched against each entity node's path string (i.e. its path from the root, delimited by slashes). Vectors in entity nodes matching pathString_regex_flatten will be flattened into a single character string value; vectors in entity nodes matching pathString_regex_explode will be exploded into multiple rows.

fieldname_regex_alwaysFlatten

A regular expression to force flattening of fields regardless of matching to other regular expressions.

returnLongDf

Whether to return a long ('tidy') data frame, with all values on a separate row, or a wide ('multivariate') data frame, where columns represent different variables. Setting this to FALSE is not yet supported.

pathString_regex_select

Regex that the target entities' path strings have to match (otherwise, the entity is excluded)

silent

Whether to be silent or chatty.

nullValue, naValue

Values to return when encountering NULL or NA.

warningValues

Values to return warnings for.

warningFunctions

A list of functions to run on the values that can return a character value - if they do, that is shown as a warning or printed (depending on the value of silent).

Value

A list or a dataframe (if returnDf is TRUE)