DFplyr-package: Treat a 'S4Vectors::DataFrame' as a 'dplyr' data source

DFplyr-packageR Documentation

Treat a S4Vectors::DataFrame as a dplyr data source

Description

Add dplyr compatibility to S4Vectors::DataFrame for use with a selection of dplyr verbs.

Arguments

x

A S4Vectors::DataFrame object

Author(s)

Maintainer: Jonathan Carroll rpkg@jcarroll.com.au (ORCID)

See Also

Useful links:

Examples

library(S4Vectors)
library(dplyr)

d <- as(mtcars, "DataFrame")

mutate(d, newvar = cyl + hp)

mutate_at(d, vars(starts_with("c")), ~ .^2)

group_by(d, cyl, am) %>%
    tally(gear)

count(d, gear, am, cyl)

select(d, am, cyl)

select(d, am, cyl) %>%
    rename2(foo = am)

arrange(d, desc(hp))

rbind(DataFrame(mtcars[1, ], row.names = "MyCar"), d) %>%
    distinct()

filter(d, am == 0)

slice(d, 3:6)

jonocarroll/DFplyr documentation built on Oct. 16, 2024, 4:56 a.m.