rowwise() allows you to compute on a data frame a row-at-a-time.
This is most useful when a vectorised function doesn't exist.
Most dplyr verbs preserve row-wise grouping. The exception is summarise(),
which return a grouped_df. You can explicitly ungroup with ungroup()
or as_tibble(), or convert to a grouped_df with group_by().
# S3 method for class 'SingleCellExperiment'
rowwise(data, ...)Input data frame.
<tidy-select> Variables to be preserved
when calling summarise(). This is typically a set of variables whose
combination uniquely identify each row.
NB: unlike group_by() you can not create new variables here but
instead you can select multiple variables with (e.g.) everything().
A row-wise data frame with class rowwise_df. Note that a
rowwise_df is implicitly grouped by row, but is not a grouped_df.
Because a rowwise has exactly one row per group it offers a small
convenience for working with list-columns. Normally, summarise() and
mutate() extract a groups worth of data with [. But when you index
a list in this way, you get back another list. When you're working with
a rowwise tibble, then dplyr will use [[ instead of [ to make your
life a little easier.
Hutchison, W.J., Keyes, T.J., The tidyomics Consortium. et al. The tidyomics ecosystem: enhancing omic data analyses. Nat Methods 21, 1166–1170 (2024). https://doi.org/10.1038/s41592-024-02299-2
Wickham H, Averick M, Bryan J, Chang W, McGowan LD, François R, et al. Welcome to the tidyverse. Journal of Open Source Software. 2019;4(43):1686. https://doi.org/10.21105/joss.01686
nest_by() for a convenient way of creating rowwise data frames
with nested data.
# TODO