Translates names between different lexicons (naming schema).
Arguments
- 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.
Examples
input <- c("file", "GSED_ID", "Ma_SF_Parent ID", "Ma_SF_C01", "Ma_SF_C02")
rename_vector(input)
#> [1] "file" "gsed_id" "sf_parent_id" "gpalac001" "gpacgc002"
rename_vector(input, lexout = "sequential", lowercase = FALSE)
#> [1] "file" "GSED_ID" "SF_Parent_ID" "C01" "C02"
rename_vector(input, lexout = "gsed", trim = "Ma_SF_")
#> [1] "file" "gsed_id" "parent_id" "gsdlac001" "gsdcgc002"