do_row: perform an operation on each line of a rowwise data frame

Description Usage Arguments Examples

Description

A do operation given multiple arguments creates a rowwise data frame. Often one wants to follow this with an operation on each line of the data frame, but this requires regrouping (which leads to an error), then performing an awkward expression with lots of .$column[[1]] in it. This is a simple wrapper of do that makes that easier.

Usage

1
do_row(x, ..., groups = NULL)

Arguments

x

a tbl

...

Additional arguments passed on to do

groups

Vector of columns to group by. If missing, will attempt to guess based on all columns that are not lists.

Examples

1
2
3
4
5
6
7
library(dplyr)
library(broom)

g <- mtcars %>% group_by(cyl) %>% do(m = lm(mpg ~ wt, .))
g %>% do_row(tidy(m))
g %>% do_row(augment(m))
g %>% do_row(tidied = tidy(m), augmented = augment(m))

StoreyLab/factorial-MA-RS documentation built on May 9, 2019, 3:10 p.m.