This function supplements an entity node with a value from another entity node. Note that the source entity cannot be a clustering entity (i.e. the value stored for that entity must be a single value); and the target entity must be a clustering entity (i.e. the value stored for that entity must be a list of values for clustered entities). Whereas for supplement_data_with_value_inSingleNode(), you have to specify the entity identifier for the entity you want to supplement, for supplement_data_with_value_inRxsProject(), use targetPathString_regex to specify which entities you would like to supplement (i.e. copy the relevant value to). Of course, this can also be an entity identifier if you only want to copy to a single entity but in all Rxs trees in an object with parsed Rxs files.

supplement_data_with_value_inRxsProject(
  x,
  sourceEntityNodeId,
  targetEntityNodeId = NULL,
  targetEntityNode_requiredField = NULL,
  forceCopyingOfExistingValues = FALSE,
  sourcePathString_regex = NULL,
  targetPathString_regex = NULL,
  targetNodeListCreation_prefix = "",
  targetNodeListCreation_suffix = "_value",
  prefix = "supplemented_",
  suffix = "",
  flattenVectors = FALSE,
  silent = metabefor::opts$get("silent")
)

supplement_data_with_value_inSingleNode(
  rxsTree,
  targetEntityNodeId,
  sourceEntityNodeId,
  forceCopyingOfExistingValues = FALSE,
  sourcePathString_regex = NULL,
  targetPathString_regex = NULL,
  targetNodeListCreation_prefix = "",
  targetNodeListCreation_suffix = "_value",
  prefix = "supplemented_",
  suffix = "",
  flattenVectors = FALSE,
  silent = metabefor::opts$get("silent")
)

Arguments

sourceEntityNodeId

The identifier of the source entity node.

targetEntityNodeId

The identifier of the target entity node (the entity node to supplement)

targetEntityNode_requiredField

A required field that, if it does not occur in the target entity, causes that target entity to be skipped. This provides additional control over which target entities to process.

forceCopyingOfExistingValues

Whether to force copying (and so overwriting) existing values if encountered in the target entity. If FALSE, existing values will not be overwritten.

sourcePathString_regex, targetPathString_regex

Regular expressions that must match the path string of the source of target node.

targetNodeListCreation_prefix, targetNodeListCreation_suffix

A prefix and suffix to add when a list is created.

prefix, suffix

A text string to prepend and append to the entity identifier when copying it to the target entity.

flattenVectors

Whether to flatten vectors when copying them over.

silent

Whether to be quiet or chatty.

rxsTree, x

The Rxs tree or the Rxs project object.

Value

Invisibly, the (altered) Rxs tree - but note that since the data.tree package uses R6's pass-by-reference semantics, that object is altered in place, and so the returned object can be discarded.