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

mutate..html

Add/modify/delete columns


Description

With mutate.() you can do 3 things:

  • Add new columns

  • Modify existing columns

  • Delete columns

Usage

mutate.(.df, ..., .by = NULL)

Arguments

.df

A data.frame or data.table

...

Columns to add/modify

.by

Columns to group by

Examples

test_df <- data.table(
  a = c(1,2,3),
  b = c(4,5,6),
  c = c("a","a","b")
)

test_df %>%
  mutate.(double_a = a * 2,
          a_plus_b = a + b)

test_df %>%
  mutate.(double_a = a * 2,
          avg_a = mean(a),
          .by = c)

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.