Here is the current behavior (in 2.15.2 and 3.0.0):
> exists(c('notLikely', 'exists'))
[1] FALSE
> exists(c('exists', 'notLikely'))
[1] TRUE
> get(c('notLikely', 'exists'))
Error in get(c("notLikely", "exists")) : object 'notLikely' not found
> get(c('exists', 'notLikely'))
function (x, where = -1, envir = if (missing(frame))
as.environment(where) else sys.frame(frame),
frame, mode = "any", inherits = TRUE)
.Internal(exists(x, envir, mode, inherits))
<bytecode: 0x000000000f7f8830>
<environment: namespace:base>
Both 'exists' and 'get' silently ignore all but the
first element.
My view is that 'get' should do what it currently does
except it should warn about ignoring subsequent elements
if there are any.
I don't see a reason why 'exists' shouldn't be vectorized.
Am I missing something?
Pat
Patrick Burns pburns at pburns.seanet.com twitter: @burnsstat @portfolioprobe http://www.portfolioprobe.com/blog http://www.burns-stat.com (home of: 'Impatient R' 'The R Inferno' 'Tao Te Programming')