require(stats)
is.a.r <- function(x) c(is.atomic(x), is.recursive(x))
is.a.r(c(a = 1, b = 3)) # TRUE FALSE
is.a.r(list()) # FALSE TRUE - a list is a list
is.a.r(list(2)) # FALSE TRUE
is.a.r(lm) # FALSE TRUE
is.a.r(y ~ x) # FALSE TRUE
is.a.r(expression(x+1)) # FALSE TRUE (nowadays)
Run the code above in your browser using DataLab