View source: R/recode_with_csv.R
recode_with_csv | R Documentation |
Recode factor or character variables with a CSV file Will take as input a path to a csv file with oldname,newname syntax. Will find each of the oldnames in the column, and replace them for newname.
recode_with_csv(
data,
csvfile = ".recode",
old_column,
new_column = {
{
old_column
}
}
)
data |
Dataset to manipulate |
csvfile |
path to a csv file with oldname, newname syntax |
old_column |
variable name to edit |
new_column |
variable name to save the result in. Will overwrite old_column if left blank |
mutated dataset
mtcars |>
mutate(gear_f = factor(gear, labels = c("three", "four","five"))) |>
rename_with_csv(csvfile,gear_f)
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.