graft {taber} | R Documentation |
Graft
Description
Graft one dataset onto another
Usage
graft(.data, combine_fun, data2)
Arguments
.data |
A tbl or something that can be coerced into one |
combine_fun |
optional, A function that will combine two tbls such as full_join or bind_rows |
data2 |
A tbl or something that can be coerced into one |
Details
Graft requires two data objects. The first must be provided by the user. The second can either be passed in or automatically pulled off of the package's internal stack of scions. These will be combined accoring to the following rules in order:
If either dataset has zero rows, the other dataset will be returned.
If combine_fun is specifed,
combine_fun(.data, data2)
will be calledIf all column names match, a row bind will occur
If at least some column names match, a full join will occur
If both have the same number of rows a column bind will be performed
Value
A single tbl object
Author(s)
Seth Wenchel
Examples
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