Re: [R] help using tryCatch

2017-01-19 Thread William Dunlap via R-help
The 'error' argument to tryCatch must be a function (of one argument, the exception). Its return value will be the return value of tryCatch if there is an error. Hence you should change the present error = return(TBAPrice) to error = function(exception) TBAPrice You can use error = f

[R] help using tryCatch

2017-01-19 Thread Glenn Schultz
All, I have  a function that I would like to return 0 or NA on unit root error but I cannot figure out how to get tryCatch to work.  I have followed the examples in the R documentation as well as some online but I am missing something.  If I added the tryCatch code I only get the error value.