Description Usage Arguments See Also Examples
Add new variables
1 2 3 4 5 6 7 8 9 | mutate_elem(.data, ...)
transmute_elem(.data, ...)
## S3 method for class 'list'
mutate(.data, ..., gather = unlist_with_nas, warn = FALSE)
## S3 method for class 'list'
transmute(.data, ..., gather = unlist_with_nas, warn = FALSE)
|
.data |
a list. |
... |
name-value pairs of expressions.
Notice: in |
gather |
before calculating the summaries, each variable is first passed through
the |
warn |
if |
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 | lst <- list(
list(a = 1:3),
list(a = 5),
list(a = c(NA, 4)),
list(a = NA),
list(a = 100)
)
lst %>% mutate_elem(norm_a = a/sum(a, na.rm = TRUE))
as_lol(mtcars) %>%
transmute(
avg_mpg = rep_list(mean(mpg), length(mpg)),
cyl = paste("it has", cyl, "cylinders")
) %>% .[1:5]
as_lol(mtcars) %>%
mutate(
avg_mpg = rep_list(mean(mpg), length(mpg)),
cyl = cyl + 1000
) %>% .[1:5]
list(
a = list(x = 1),
b = list(x = 2),
c = list(x = 3),
list(x = 4)
) %>%
mutate(y = x / sum(x))
|
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.