mutate: Mutate multiple columns

Description Usage Arguments Value Note See Also Examples

Description

Mutate multiple columns

Usage

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
mutateAll(object, fun, ...)

mutateAll(object, fun, ...)

mutateIf(object, predicate, fun, ...)

transmuteAt(object, vars, fun, ...)

transmuteIf(object, predicate, fun, ...)

## S4 method for signature 'DataFrame,'function''
mutateAll(object, fun, ...)

## S4 method for signature 'DataFrame,character,'function''
mutateAt(object, vars, fun, ...)

## S4 method for signature 'DataFrame,'function','function''
mutateIf(object, predicate, fun, ...)

## S4 method for signature 'DataFrame,character,'function''
transmuteAt(object, vars, fun, ...)

## S4 method for signature 'DataFrame,'function','function''
transmuteIf(object, predicate, fun, ...)

Arguments

object

Object.

fun

function. Mutation function.

...

Passthrough arguments to function declared in fun argument.

vars

character. Column names.

predicate

function. A predicate function to be applied to the columns. For example, is.atomic().

Value

Modified object.

Note

Updated 2020-01-08.

See Also

These functions are inspired by dplyr. However, they are designed to only work on Bioconductor S4 class objects, and use base R code internally.

Examples

1
2
3
4
5
6
7
8
9
data(mtcars, package = "datasets")

## DataFrame ====
x <- as(mtcars, "DataFrame")
mutateAll(x, fun = log, base = 2L)
mutateAt(x, vars = c("mpg", "cyl"), fun = log, base = 2L)
mutateIf(x, predicate = is.double, fun = as.integer)
transmuteAt(x, vars = c("mpg", "cyl"), fun = log, base = 2L)
transmuteIf(x, predicate = is.double, fun = as.integer)

acidgenomics/transformer documentation built on Jan. 9, 2020, 11:34 a.m.