Learn R Programming

epistasis (version 0.0.2)

collapseListOfIdenticalElements: Check whether all elements of a list are identical then return one element

Description

Check whether all elements of a list are identical, then return one element.

Usage

collapseListOfIdenticalElements(x)

Arguments

x
List.

Value

  • x[[1]]

Details

Names of x are ignored. This is a rather trivial convenience function.

Examples

Run this code
b = lapply(seq(0, 2*pi, length=100), function(x) sin(x))
  a = lapply(seq(0, 2*pi, length=100), function(x) sin)

  collapseListOfIdenticalElements(a)
  tryCatch( collapseListOfIdenticalElements(b), error=get("("))

Run the code above in your browser using DataLab