Learn R Programming

taber (version 0.1.2)

scion: scion

Description

scion

Usage

scion(.data, ..., false_fun, false_name, false_env)

Arguments

.data

A tbl or something that can be coerced into one

...

conditions that will be passed to dplyr::filter

false_fun

A function or functional that will be applied to the data that doesn't pass the supplied filters (the scion)

false_name

optional, the name of the object to which the scion will be assigned.

false_env

optional, the environment into which the scion will be assigned. If specified, false_name must also be specified. If unspecified (default), scions will be placed into the internal package environment.

Value

A tbl whose rows have passed the stated conditions

Details

.data will be split into two chunks based on the conditions. The scion will be passed through false_fun and then either placed on the package's internal stack or assigned as specified by false_name and false_env.

Examples

Run this code
# NOT RUN {
library(dplyr)
aframe <- data.frame(zed = runif(100))
set_to_zero <- . %>% mutate(zed = 0)
aframe %>% scion(zed >0.5, false_fun=set_to_zero) %>% mutate(zed=1) %>% graft

# }

Run the code above in your browser using DataLab