I wish to get NA when a function returns an Error rather than the code halting.
I currently use
try.test<-try(results<-lm(log(0)~1))
if(class(try.test)=="try-error"){results<-NA}
I also tried playing with tryCatch.
I would like to find a single function/line solution.
Try
But this catches all errors, not just those from log(0).