[R] Understanding tryCatch
wwwhsd at gmail.com
Fri Mar 18 20:17:34 CET 2011
tryCatch(log(rnorm(10)), warning = function(m)deparse(m$call[]))
Where log(rnorm(10)) is your expr to evaluate.
On Fri, Mar 18, 2011 at 4:04 PM, steven mosher <moshersteven at gmail.com> wrote:
> I've read the help and the archives on tryCatch but I'm still stuggling
> trying to understand how it
> works exactly and how I can use it to get the result I need.
> I have a data.frame of urls which point to 11 .zip files. Basically I use
> RCurl to get the list of
> files from a ftp and then reduce that directory dump to the 11 zip files I
> want to download.
> Its easy enough to do that in a loop over the elements in data.frame.
> The problem is that the site is very inconsistent. All 11 files will
> download, but I will get random
> warnings that the size of some of the files does not match what was
> So at the end of the loop I may get 5 warnings about the file size not
> These files, when tried a second or third time, will eventually download
> What I want to do is record which files had this download warning.
> [[alternative HTML version deleted]]
> R-help at r-project.org mailing list
> PLEASE do read the posting guide http://www.R-project.org/posting-guide.html
> and provide commented, minimal, self-contained, reproducible code.
25° 25' 40" S 49° 16' 22" O
More information about the R-help