rename_element: Change Names of Elements In Specific Column

View source: R/helpful_functions.R

rename_elementR Documentation

Change Names of Elements In Specific Column

Description

The function will rename elements in a specific column by vectors "old_name" and "new_name". Simply give the function a vector with old names that should be renamed by a vector with new names. _Be carefull that elements in new_name have the rigth position_ (e.g. the second element in "old_name" will be replaced by the second element in "new_name").

Usage

rename_element(df, colname, old_name, new_name)

Arguments

df

data.frame; input data.frame

colname

character; name of the column storing the elements to be renamed

old_name

vector; elements that should be renamed in column specified by 'colname'

new_name

vector; new names of the elements specified by "old_name"

Value

data.frame; with renamed elements in "colname"

Examples

rename_element(root_output,
  colname = "Label",
  old_name = c("Col_0;28", "Col_0;20"), new_name = c("Col0_28", "Col0_20")
)

PhilippJanitza/rootdetectR documentation built on Feb. 24, 2024, 6:46 a.m.