mutate_rowwise.: Add/modify columns by row

Description Usage Arguments Examples

View source: R/mutate_rowwise.R

Description

Allows you to mutate "by row". this is most useful when a vectorized function doesn't exist.

Usage

1

Arguments

.df

A data.table or data.frame

...

Columns to add/modify

Examples

1
2
3
4
5
6
7
8
9
test_df <- data.table(x = runif(6), y = runif(6), z = runif(6))

# Compute the mean of x, y, z in each row
test_df %>%
  mutate_rowwise.(row_mean = mean(c(x, y, z)))

# Use c_across.() to more easily select many variables
test_df %>%
  mutate_rowwise.(row_mean = mean(c_across.(x:z)))

mtfairbanks/gdt documentation built on May 4, 2021, 9:44 a.m.