Learn R Programming

tidytable (version 0.10.2)

c_across: Combine values from multiple columns

Description

c_across() works inside of mutate_rowwise(). It uses tidyselect so you can easily select multiple variables.

Usage

c_across(cols = everything())

Arguments

cols

Columns to transform.

Examples

Run this code
df <- data.table(x = runif(6), y = runif(6), z = runif(6))

df %>%
  mutate_rowwise(row_mean = mean(c_across(x:z)))

Run the code above in your browser using DataLab