subsetDfCon: Taking a subset of a data frame in accordance with one or...

View source: R/struc__subsetDfCon.R

subsetDfConR Documentation

Taking a subset of a data frame in accordance with one or more conditions provided in the second data frame.

Description

Taking a subset of a data frame in accordance with one or more conditions provided in the second data frame.

Usage

subsetDfCon(subject, conditions, col.subject = 1, col.con = 1)

Arguments

subject:

the data frame to be subset

conditions:

a data frame whose columns provide conditions for selecting rows in the subject.

col.subject:

column names or indices in the subject data frame to be searched for

col.con:

column names or indices in the condition data frame to be used as conditions for searching rows in the subject data frame

Note that col.subject and col.con must be matched in terms of the order of comparisons. x$a1 will be searched for values in y$a1, and so forth: d <- subsetDfCon(subject = x, conditions = y, col.subject = c("a1", "a2), col.con = c("a1", "b1")) x[, 2] will be searched for values in y[, 3], for example: d <- subsetDfCon(subject = x, conditions = y, col.subject = c(1, 2, 3), col.con = c(1, 3, 5))

Author(s)

Yu Wan (wanyuac@gmail.com)


wanyuac/handyR documentation built on June 10, 2024, 1:24 a.m.