set_names_from_template: Safe header renaming from a template file

Description Usage Arguments Details Examples

View source: R/set_names_from_template.R

Description

Safe header renaming from a template file

Usage

1
set_names_from_template(x, path, use_column = new_name)

Arguments

x

a tbl() to rename

path

the path to save the template into

use_column

the column for the new names, expects a quasiquotation (dplyr style)

Details

Renames a tibble or a data.frame from a template file. The renaming is safe in the sense that if the template doesn't include a specific header, it remains unchanged. Templates can be created with 'make_header_template'.

Examples

1
2
3
4
5
mtcars %>% make_header_template(path = "mtcar_headers.csv")
mtcars %>% set_names_from_template(path = "mtcar_headers.csv")

iris %>% make_header_template(path = "iris_headers.xlsx")
iris %>% set_names_from_template(path = "iris_headers.xlsx")

sarid-ins/saridr documentation built on Nov. 10, 2020, 9:07 p.m.