Assigning the value directly to result[i] would give a null to result. Like
that:

result[[i]]<-taxondiveO(abd,taxa)
result[[i]]<-as.data.frame(result[[i]])[1,]

In fact your code's result should have null elements in it. You lost your
nulls through do.call process.

I can't find a way to assign the value of error into a object. So, try()
inside loop should work. Like

for (....) {
if (class(try(...,silent=T))=="try-error") result[[i]] <- NA
...
}



-----
A R learner.
-- 
View this message in context: 
http://r.789695.n4.nabble.com/try-error-within-for-loop-tp2315550p2315738.html
Sent from the R help mailing list archive at Nabble.com.

______________________________________________
R-help@r-project.org mailing list
https://stat.ethz.ch/mailman/listinfo/r-help
PLEASE do read the posting guide http://www.R-project.org/posting-guide.html
and provide commented, minimal, self-contained, reproducible code.

Reply via email to