rename_enframed: Rename 'tibble' columns according to values in another...

View source: R/enframed_and_labelled.R

rename_enframedR Documentation

Rename tibble columns according to values in another tibble.

Description

This function renames variables from d according to the columns in d.enframed, which should be in enframed format (two columns named name and value, see tibble::enframe() for details). It will rename from according to d.enframed$name, and to according to d.enframed$value

⁠NOTE:⁠ This function may merit deprecation, because dplyr::rename_with(), coupled with lookup(), deals quite well with this use-case (and is more general).

d.enframed = tibble::enframe(c(a="New A", b="New B"))

Usage

rename_enframed(d, d.enframed)

Arguments

d

The tibble whose columns we want to rename.

d.enframed

The ⁠enframed tibble⁠ with the old and new names.

Value

A tibble that is identical to d but with renamed columns.


torfason/zulutils documentation built on Aug. 21, 2023, 5:46 p.m.