eat: Eat columns from another data frame

Description Usage Arguments Details Value

View source: R/03_eat.R

Description

Modified join where only a specified subset of y is kept, with optional checks and transformations.

Usage

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
eat(
  .x,
  .y,
  ...,
  .by = NULL,
  .na_matches = c("na", "never"),
  .match_fun = NULL,
  .agg = NULL,
  .check = "~blC",
  .conflict = NULL,
  .prefix = NULL,
  .fill = NULL,
  .mode = c("left", "right", "inner", "full")
)

Arguments

.x, .y

tbls to join

...

One or more unquoted expressions, passed to dplyr::select, defining the columns to keep from .y

.by

a character vector of variables to join by, or a formula defining a joining condition using a notation such as ~ X("var1") > Y("var2") & X("var3") < Y("var4")

.na_matches

Use "never" to always treat two NA or NaN values as different, like joins for database sources, similarly to merge(incomparables = FALSE).

.match_fun

Vectorized function given two columns, returning TRUE or FALSE as to whether they are a match. Can be a list of functions one for each pair of columns specified in by (if a named list, it uses the names in .x). If only one function is given it is used on all column pairs.

.agg

function or formula or NULL, if not NULL, .y will be grouped by its .by columns and .agg will be applied to all kept columns from .y.

.check

a string, see details about check parameter in ?safe_joins

.conflict

if NULL, in case of column conflict both columns are suffixed as in dplyr, if a function of two parameters or a formula, a function is applied on both columns. If the string "patch", matched values from .y will overwrite existing values in .x while the other values will be kept'

.prefix

prefix of new columns or function/formula to apply on names of new columns

.fill

if not NULL, value to fill missing values in eaten columns

.mode

type of join on build on, a left join by default

Details

Character codes are the same as for safe_*_join functions, with the addition of "d"to check if dots were filled.

Value

a data frame


moodymudskipper/safejoin documentation built on Sept. 2, 2020, 3:08 a.m.