at_mutate: Manipulate attributes in a dplyr fashion

Description Usage Arguments Value See Also Examples

View source: R/verbs_for_attributes.R

Description

The function at_mutate adds or changes attributes to obj.

The function at_select selects attributes of obj, and removes the others.

The function at_rename renames attributes of obj.

The function at_slice chooses a specific attribute and returns it.

Usage

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
at_mutate(obj, ...)

at_mutate_(obj, ..., .dots)

at_select(obj, ...)

at_select_(obj, ..., .dots)

at_rename(obj, ...)

at_rename_(obj, ..., .dots)

at_slice(obj, at)

at_slice_(obj, at)

Arguments

obj

An object.

...

Comma separated list of unquoted expressions.

.dots

Used to work around non-standard evaluation.

at

Attribute to be obtained.

Value

at_slice returns the attribute chosen. The other functions return obj with possibly modified attributes.

See Also

structure, attributes

Examples

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
18
19
library(dplyr)
df <- data.frame(x = sample(10, 5, rep = TRUE),
                 y = sample(10, 5, rep = TRUE)) %>%
  at_mutate(example = "yes",
            package = "dplyr")
tribe(df)

at_slice(df, names)
at_slice_(df, "class")
at_slice_(df, ~ package)

df <- df %>%
  at_mutate_(package = ~ NULL,
             example = ~ "no")
tribe(df)

df <- df %>% 
  at_mutate_(.dots = list(x = ~ 2, y = ~ c(3,4)))
tribe(df)

tribe documentation built on Dec. 1, 2019, 1:24 a.m.