mutate {dplyr} | R Documentation

## Add new variables.

### Description

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`, `arrange_`; `filter`, `filter_`; `rename`, `rename_`, `select`, `select_`; `slice`, `slice_`; `summarise`, `summarise_`, `summarize`, `summarize_`

### Examples

    mutate(mtcars, displ_l = disp / 61.0237)
    transmute(mtcars, displ_l = disp / 61.0237)

    mutate(mtcars, cyl = NULL)

[Package dplyr version 0.4.3 Index]