Become an expert in R — Interactive courses, Cheat Sheets, certificates and more!
Get Started for Free

rename_with..html

Rename multiple columns


Description

Rename multiple columns with the same transformation

Usage

rename_with.(.df, .fn, .cols = everything(), ...)

Arguments

.df

A data.table or data.frame

.fn

Function to transform the names with.

.cols

Columns to rename. Defaults to all columns. tidyselect compatible.

...

Other parameters to pass to the function

Examples

test_df <- data.table(
  x = 1,
  y = 2,
  double_x = 2,
  double_y = 4
)

test_df %>%
  rename_with.(toupper)

test_df %>%
  rename_with.(~ toupper(.x))

test_df %>%
  rename_with.(~ toupper(.x), .cols = c(x, double_x))

tidytable

Tidy Interface to 'data.table'

v0.6.1
MIT + file LICENSE
Authors
Mark Fairbanks [aut, cre], Abdessabour Moutik [ctb], Matt Carlson [ctb], Ivan Leung [ctb], Ross Kennedy [ctb]
Initial release

We don't support your browser anymore

Please choose more modern alternatives, such as Google Chrome or Mozilla Firefox.