caseveq: A vectorised version of clojR::case (with '==' function)

Description Usage Arguments Examples

Description

See https://clojuredocs.org/clojure.core/case.

Usage

1
caseveq(obj, ...)

Arguments

obj

An object/value.

...

An odd number of expressions. A set of test/expression pairs plus an expression to be evalauted if all tests fail. Equivalent of nested ifelse(x == a, b, c) calls, where x are elements of the obj vector.

Examples

1
2
3
4
5
6
7
8
caseveq(x,
          Inf,            "infinity",
          as.numeric(NA), "not available",
                          "other")
# Is transformed to:
# ifelse(x == Inf, "infinity",
#        ifelse(x == as.numeric(NA), "not available",
#                                     "other"))

alekrutkowski/clojR documentation built on May 11, 2019, 11:24 p.m.