Learn R Programming

Gmisc (version 3.0.3)

has: An R alternative to the lodash has in JavaScript

Description

This is a handy function for checking if item exist in a nested structure

Usage

has(sourceList, path)

Value

Returns a boolean.

Arguments

sourceList

The list()/c() that is to be searched for the element

path

A string that can be separated by [,] or ., the string "elementname1.1.elementname" the validity of the path - it only separates and tries to address that element with `[[]]`.

See Also

Other lodash similar functions: retrieve()

Examples

Run this code
has(list(a = list(b = 1)), "a.b")

Run the code above in your browser using DataLab