in clojure can this:
(def x {:a 1 :b 2}) (def y (or (:c x) 111)) in r can this:
x = list(a = 1, b = 2) y = { if ("c" %in% names(x)) { x$c } else { 111 } } it works, far less elegant. there better way?
defined in dplyr not exported (https://github.com/hadley/dplyr/blob/master/r/utils.r#l81) operator
"%||%" <- function(x, y) if(is.null(x)) y else x then can write it
x$a %||% 1111
Comments
Post a Comment