Description Usage Arguments Value Examples
Wrapper around rowSums
etc. to allow
calculating row sums and means of flexibly supplied column names
from a df. Accepts select_helpers
.
Designed for external use in pipe-chains, outside of mutate
.
1 2 3 | tidyselect_row_sums(.data, ..., .value = "row_sum", na.rm = FALSE)
tidyselect_row_means(.data, ..., .value = "row_mean", na.rm = FALSE)
|
.data |
A tbl: a |
... |
One or more unquoted variable names. Accepts |
.value |
The name of the new column, as a string. |
na.rm |
a logical value indicating whether NA values should be stripped before the computation proceeds. |
An object of the same class as .data
, with the computed column added.
1 2 3 4 | data <- tibble::tibble(x1 = 1:5, x2 = 1:5, x3 = 1:5)
tidyselect_row_sums(data, dplyr::starts_with("x"))
tidyselect_row_means(data, dplyr::starts_with("x"))
|
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.