I was using this
exists function to see if an object is in my environment or not. However, when I apply
!exists inside the
sapply, it throws an error. Does anyone know why this is happening?
code is below
x <- c(2,3,4) y <- c(5,6,9) any(sapply(c("x", "y"), exists)) # it works but any(sapply(c("x", "y"), !exists)) # not working