pipe: Pipe data

Description Usage Arguments Note Examples

Description

Pipe data from one datadr operation to another

Usage

1
lhs %>% rhs

Arguments

lhs

a data object

rhs

a function to apply to the data

Note

Pipes are great if you know the exact sequence of operations you would like to perform and fully understand what the intermediate data structures will look like. But often with very large or complex data sets it can be a good idea to do each step independently and examine the intermediate results. This can be better for debugging, particularly when each step takes some time to evaluate.

Examples

1
2
3
4
5
6
7
8
9
# Suppose we wish to do the following:
bySpecies <- divide(iris, by = "Species")
bySpeciesTransformed <- addTransform(bySpecies, function(x) mean(x$Sepal.Length))
recombine(bySpeciesTransformed, combine = combRbind)

# We can do it more consely using the pipe: '%>%'
divide(iris, by = "Species") %>%
  addTransform(function(x) mean(x$Sepal.Length)) %>%
    recombine(combRbind)

datadr documentation built on May 1, 2019, 8:06 p.m.