View source: R/rename_vector.R
rename_vector | R Documentation |
Translates names between different lexicons (naming schema).
rename_vector(
input,
lexin = c("original", "sequential", "gsed", "gsed2"),
lexout = c("gsed2", "original", "sequential", "gsed"),
notfound = "copy",
contains = c("", "Ma_SF_", "Ma_LF_", "bsid_"),
underscore = TRUE,
trim = "Ma_",
lowercase = TRUE
)
input |
A character vector with names to be translated |
lexin |
A string indicating the input lexicon. One of "original", "sequential", "gsed" or "gsed2". Default is "original". |
lexout |
A string indicating the output lexicon. One of "original", "sequential", "gsed" or "gsed2". Default is "gsed2". |
notfound |
A string indicating what to do some input value is not found |
contains |
A string to filter the translation table prior to matching. Needed to prevent double matches. The default ("") does not filter. |
underscore |
Replaces space (" ") and dash ("-") by underscore ("_") |
trim |
A substring to be removed from 'input'. Defaults to "Ma_". |
lowercase |
Sets all variables in lower case. in 'lexin'? The default 'notfound = "copy"' copies the input values into the output value. In other cases (e.g. '""' or 'NA_character_'), the function uses the string specified in 'notfound' as a replacement value. |
A character vector of the same length as 'input' with processed names.
input <- c("file", "GSED_ID", "Ma_SF_Parent ID", "Ma_SF_C01", "Ma_SF_C02")
rename_vector(input)
rename_vector(input, lexout = "sequential", lowercase = FALSE)
rename_vector(input, lexout = "gsed", trim = "Ma_SF_")
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.