dplyr_extending: Extending dplyr with new data frame subclasses

Description Usage Arguments Basic advice Current usage

Description

\Sexpr[results=rd, stage=render]{lifecycle::badge("experimental")}

These three functions, along with names<- and 1d numeric [ (i.e. x[loc]) methods, provide a minimal interface for extending dplyr to work with new data frame subclasses. This means that for simple cases you should only need to provide a couple of methods, rather than a method for every dplyr verb.

These functions are a stop-gap measure until we figure out how to solve the problem more generally, but it's likely that any code you write to implement them will find a home in what comes next.

Usage

1
2
3
4
5

Arguments

data

A tibble. We use tibbles because they avoid some inconsistent subset-assignment use cases

i

A numeric or logical vector that indexes the rows of .data.

cols

A named list used modify columns. A NULL value should remove an existing column.

template

Template to use for restoring attributes

Basic advice

This section gives you basic advice if you want to extend dplyr to work with your custom data frame subclass, and you want the dplyr methods to behave in basically the same way.

Current usage

Note that group_by() and ungroup() don't use any these generics and you'll need to provide methods directly.


dplyr documentation built on June 19, 2021, 1:07 a.m.