fct_recode_helper: fct_recode helper to recode multiple variables

View source: R/utils.R

fct_recode_helperR Documentation

fct_recode helper to recode multiple variables

Description

fct_recode helper to recode multiple variables

Usage

fct_recode_helper(
  data,
  .cols = -where(is.numeric),
  name_in,
  name_out,
  style = c("mutate", "base"),
  reminder = TRUE,
  cat = TRUE
)

Arguments

data

The data frame.

.cols

<tidy-select> The variables to recode.

name_in

The name of the input data frame. Default to the expression given in data.

name_out

The name of the output data frame, if different from the input data frame.

style

Default is to use dplyr::mutate(). Set to base to use ⁠data$var <-⁠ style.

reminder

By default, a reminder of the syntax ("new" = "old") is printed. Set to FALSE to remove it.

cat

By default the result is written in the console if there are less than 6 variables, written in a temporary file and opened otherwise. Set to false to get a data frame with a character variable instead.

Value

When the number of variables is less than 5, a text in console as a side effect. With more than 5 variables, a temporary R file. A tibble with the recode text as a character variable is returned invisibly (or as main result if cat = TRUE). If the labelled package in installed, the variable label is used as title in a comment.


BriceNocenti/tablr documentation built on April 12, 2025, 12:56 a.m.