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

mutate_rowwise..html

Add/modify columns by row


Description

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

Usage

mutate_rowwise.(.df, ...)

Arguments

.df

A data.table or data.frame

...

Columns to add/modify

Examples

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)))

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.