Become an expert in R — Interactive courses, Cheat Sheets, certificates and more!
Get Started for Free

has_element

Check if an Object is Element of a List


Description

Simply checks if a list contains a given object.

  • NB1: Objects are compared with identity.

  • NB2: Only use this on lists with complex objects, for simpler structures there are faster operations.

  • NB3: Clones of R6 objects are not detected.

Usage

has_element(.x, .y)

Arguments

.x

(list() | atomic vector()).

.y

(any)
Object to test for.

Examples

has_element(list(1, 2, 3), 1)

mlr3misc

Helper Functions for 'mlr3'

v0.10.0
LGPL-3
Authors
Michel Lang [cre, aut] (<https://orcid.org/0000-0001-9754-0393>), Patrick Schratz [aut] (<https://orcid.org/0000-0003-0748-6624>)
Initial release

We don't support your browser anymore

Please choose more modern alternatives, such as Google Chrome or Mozilla Firefox.