Learn R Programming

flashlight (version 0.3.0)

all_identical: all_identical

Description

Checks if an aspect is identical for all elements in a nested list. The aspect is specified by fun, e.g. `[[`, followed by the element name to compare.

Usage

all_identical(x, fun, ...)

Arguments

x

A nested list of objects.

fun

Function used to extract information of each element of x.

...

Further arguments passed to fun.

Value

A logical vector of length one.

Examples

Run this code
# NOT RUN {
x <- list(a = 1, b = 2)
y <- list(a = 1, b = 3)
all_identical(list(x, y), `[[`, "a")
all_identical(list(x, y), `[[`, "b")
# }

Run the code above in your browser using DataLab