Learn R Programming

ParallelLogger (version 1.1.1)

matchInList: In a list of object of the same type, find those that match the input

Description

In a list of object of the same type, find those that match the input

Usage

matchInList(x, toMatch)

Arguments

x

A list of objects of the same type.

toMatch

The object to match.

Value

A list of objects that match the toMatch object.

Details

Typically, toMatch will contain a subset of the variables that are in the objects in the list. Any object matching all variables in toMatch will be included in the result.

Examples

Run this code
# NOT RUN {
x <- list(a = list(name = "John", age = 25, gender = "M"),
          b = list(name = "Mary", age = 24, gender = "F"))

matchInList(x, list(name = "Mary"))

# [[1]]
# [[1]]$name
# [1] "Mary"
# 
# [[1]]$age
# [1] 24

# }

Run the code above in your browser using DataLab