I think your function has to have cond
as an argument – at least that's how I've used tryCatch()
in the past, and your error message seems to indicate it as the problem.
Try the following:
gethelp.df =tryCatch(htmlTreeParse(gethelp.url, useInternalNodes = T), error = function(cond) next)
Note that the above line will still throw an error, b/c the example code is not in a loop. So I just replaced next
with NA
, and it worked fine.
Edit: In response to OP's comment, I suggest trying the following:
gethelp.df =tryCatch(htmlTreeParse(gethelp.url, useInternalNodes = T), error = function(cond)"skip")
if(gethelp.df=="skip"){next}