casevid: A vectorised version of clojR::case (with vectorised identity...

Description Usage Arguments Examples

Description

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

Usage

1
casevid(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(iden(x,a), b, c) calls, where x are elements of the obj vector and iden is a vectorised base::identity function.

Examples

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

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