match_multi: Match across columns for multiple lookup values

Description Usage Arguments Value Examples

View source: R/match_multi.R

Description

This provides a succinct way to query a data frame for conditions, which is otherwise very verbose in base R or dplyr

Usage

1
match_multi(x, cols, table, incomparables = NULL)

Arguments

x

data.frame

cols

character vector of column names to be found in x

table

vector of items to find

incomparables

passed on to the base function match

Value

matrix with same number of rows as x, and a column for each of cols

Examples

1
2
3
4
5
j <- cars[1:10, ]
match_multi(j, "speed", 7)
match_multi(j, "dist", 22)
match_multi(j, c("speed", "dist"), 10)
match_multi(j, c("speed", "dist"), c(7, 17))

jackwasey/jwutil documentation built on Jan. 20, 2020, 6:56 p.m.