filter_by_union: Select rows matching any column present in another data.frame

View source: R/utils_dplyr.R

filter_by_unionR Documentation

Select rows matching any column present in another data.frame

Description

Select values from a data.frame df matching any column from another data.frame or a selection of row indices. If a second data frame and a selection of rows is provided, values from df matching any value in df2[rows, ] are returned. If only rows indices are provided, rows matching any value in df[rows, ] are returned. NAs are not matched.

This is a wrapper around dplyr::filter with if_any for the case where the value should be in a reference set, with the option to choose whether to use another data frame or a subset of rows as the reference.

Usage

filter_by_union(df, df2 = NULL, rows = NULL, by = NULL, verbose = TRUE)

Arguments

df

A data.frame from which to select matching rows

df2

Optional, a second data frame

rows

Row indices for subsetting, either df2 if present or df

by

= columns to select from df2

verbose

Print information about how tables are joined? (Default: TRUE)

Author(s)

Helen Lindsay


HelenLindsay/AbNames documentation built on June 6, 2023, 1:18 p.m.