prune: Identify Rows for Prunning

View source: R/prune_01-A_prune.R

pruneR Documentation

Identify Rows for Prunning

Description

Identify rows for prunning.

Usage

prune(data, id = NA_character_, prune_var = "prune_id", func = NULL, cols, ...)

Arguments

data

Dataframe.

id

String. ID used to identify the rows in column prune_var.

prune_var

The name of the column with the prune id. Default is "prune_id".

func

Function used to select the rows meeting the condition for prunning. Default is NULL. If identity() is used, nothing will be done.

cols

Names of columns to apply func to. Must be a character vector with a minimum length of one.

...

Additional arguments used by func.

Details

Set the column prune_var to id if the condition defined by func is met.

Value

Dataframe with updated prune_var column.

prune

When func = NULL and id = NA_character_ and the column does not exist, then it will be created and filled with NA. If the column the column prune_var already exists, an error will be issued. If you intend to reset the column values to NA, just delete it and create

When func = NULL and id != NA_character, then an error message will be issued as an id cannot exist without a corresponding function.

When func != NULL and id != NA_character, then all elements of column prune_var selected by func will be set to id if they are NA or already set to id, that is the rows with a pre-existing value other than id will be kept as is. This is necessary to ensure that previous id are kept which is very useful when some id are subsets of others be must be kept. For example when one wants to keep zeros be exclude other values in a range then we would prune for zeros then prune for the range.

When func != NULL and id = NA_character, then an error message will be issued as a function must always have a corresponding id.

See Also

prune_proc


FrankLef/eflMuncher documentation built on July 9, 2022, 11:43 a.m.