add_suffix {iNZightTools} | R Documentation |
Add suffix to string
Description
When creating new variables or modifying the data set, we often add a suffix added to distinguish the new name from the original one. However, if the same action is performed twice (for example, filtering a data set), the suffix is duplicated (data.filtered.filtered). This function averts this by adding the suffix if it doesn't exist, and otherwise appending a counter (data.filtered2).
Usage
add_suffix(name, suffix)
Arguments
name |
a character vector containing (original) names |
suffix |
the suffix to add, a length-one character vector |
Value
character vector of names with suffix appended
Examples
add_suffix("data", "filtered")
add_suffix(c("data.filtered", "data.filtered.reshaped"), "filtered")
[Package iNZightTools version 2.0.1 Index]