View source: R/combine_cases.R
combine_cases | R Documentation |
Groups .data
by ...
and applies .f
to all other columns
combine_cases(.data, ..., .f)
.data |
A data frame |
... |
Unquoted grouping variables within |
.f |
A summary function. Defaults to first non-missing value |
a tbl
Sven Halvorson
## Not run:
example_data = tibble(
id = sample(letters, size = 100, replace = TRUE),
bin = sample(0:1, size = 100, replace = TRUE),
normal = rnorm(n = 100)
) %>%
arrange(id, bin, normal)
example_data[2:ncol(example_data)] = lapply(
example_data[2:ncol(example_data)],
function(x){x[rnorm(length(x)) < -0.5] = NA;x}
)
combine_cases(
.data = example_data,
id
)
## End(Not run)
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.