Rename rows of a list

Share:

Description

Sometimes, certain nodes in an XML ancestory may want to be neglected before any keys are created (see add_key) or observations are aggregated (see collapse). This function takes a list of "observations" (that is, a list of matrices with one row) and alters the names of that list. Note that any information lost from changing names is saved in a new column whose name is specified by diff.name.

Usage

1
2
re_name(obs, namez, equiv, diff.name = "diff_name", rename.as,
  quiet = FALSE)

Arguments

obs

list. Should be the output from XML2Obs (or listsToObs).

namez

must be equivalent to names(obs). Intended use is to avoid unneccessarily repeating that operation.

equiv

character vector with the appropriate (unique) names that should be regarded "equivalent".

diff.name

character string used for naming the variable that is appended to any observations whose name was overwritten. The value for this variable is the difference in from the original name and the overwritten name.

rename.as

character string to override naming of observations that are renamed.

quiet

logical. Include message about how observations are being renamed?

Value

A list of "observations".