mutate

0th

Percentile

Add new variables.

Mutate adds new variables and preserves existing; transmute drops existing variables.

Usage
mutate(.data, ...)

mutate_(.data, ..., .dots)

transmute(.data, ...)

transmute_(.data, ..., .dots)

Arguments
.data

A tbl. All main verbs are S3 generics and provide methods for tbl_df, tbl_dt and tbl_sql.

...

Name-value pairs of expressions. Use NULL to drop a variable.

.dots

Used to work around non-standard evaluation. See vignette("nse") for details.

Value

An object of the same class as .data.

Data frame row names are silently dropped. To preserve, convert to an explicit variable.

See Also

Other single.table.verbs: arrange, filter, select, slice, summarise

Aliases
  • mutate
  • mutate_
  • transmute
  • transmute_
Examples
library(dplyr) mutate(mtcars, displ_l = disp / 61.0237) transmute(mtcars, displ_l = disp / 61.0237) mutate(mtcars, cyl = NULL)
Documentation reproduced from package dplyr, version 0.5.0, License: MIT + file LICENSE

Community examples

yuelin@gmail.com at Mar 15, 2018 dplyr v0.7.3

# NOT RUN { # Newly created variables are available immediately mtcars %>% as_tibble() %>% mutate( cyl2 = cyl * 2, cyl4 = cyl2 * 2 )