Re: [R] Help with tryCatch with a for loop

2011-11-09 Thread William Dunlap
Bill Dunlap Spotfire, TIBCO Software wdunlap tibco.com > -Original Message- > From: r-help-boun...@r-project.org [mailto:r-help-boun...@r-project.org] On > Behalf Of Spencer S > Sent: Wednesday, November 09, 2011 2:57 PM > To: r-help@r-project.org > Subject: Re: [R]

Re: [R] Help with tryCatch with a for loop

2011-11-09 Thread Spencer S
My apologies for not including some test data. Attached is a sample dataset that fails with the first stateroute and works with the second. http://r.789695.n4.nabble.com/file/n4021696/testdata.csv testdata.csv -- View this message in context: http://r.789695.n4.nabble.com/Help-with-tryCatch-wi

Re: [R] Help with tryCatch with a for loop

2011-11-09 Thread Jeff Newmiller
Without a sample data set that fails the first pass and succeeds on the second pass this is a pain to test. Don't forget to read the posting guide... Reproducible sample code isn't too reproducible without some specified data or autogenerated data. ---

[R] Help with tryCatch with a for loop

2011-11-09 Thread Spencer S
Hello all, I'm a beginner in R working on a script that will produce a set of models (linear, polynomial and logistic) for each location in a dataset. However, the self-starting logistic model often fails - if this happens I would like to just skip to the next iteration of the loop using tryCatch

Re: [R] Help with tryCatch

2011-07-10 Thread eric
Bill, first off, thanks much for helping me through this. I think the best approach might be for me to attach the actual code. I could probably do the if-else-else that you suggested. But I have eight different variables with the same basic issue (note that six of the eight are commented out whil

Re: [R] Help with tryCatch

2011-07-10 Thread William Dunlap
Dunlap Spotfire, TIBCO Software wdunlap tibco.com > -Original Message- > From: r-help-boun...@r-project.org > [mailto:r-help-boun...@r-project.org] On Behalf Of eric > Sent: Sunday, July 10, 2011 12:38 PM > To: r-help@r-project.org > Subject: Re: [R] Help with tryCatch &

Re: [R] Help with tryCatch

2011-07-10 Thread eric
I tried the following: zest[i] <- tryCatch(sapply(getNodeSet(zdoc, "//zestimate/amount"), xmlValue), error=function() NA) Here's what happens : Error in zest[i] <- tryCatch(sapply(getNodeSet(zdoc, "//zestimate/amount"), : replacement has length zero -- View this message in context: http:

Re: [R] Help with tryCatch

2011-07-10 Thread William Dunlap
e good reason to want to return a single NA if any iteration of sapply causes an error. Bill Dunlap Spotfire, TIBCO Software wdunlap tibco.com > -Original Message- > From: r-help-boun...@r-project.org > [mailto:r-help-boun...@r-project.org] On Behalf Of eric > Sent: Sunday, J

[R] Help with tryCatch

2011-07-10 Thread eric
Having a hard time understanding the help files for tryCatch. Looking for a little help with the following statement which sits inside a for loop zest[i] <- tryCatch(sapply(getNodeSet(zdoc, "//zestimate/amount"), xmlValue), error=function() zest[i] <-"NA") zest is a numeric vector If the sapply

Re: [R] Help with tryCatch

2010-01-01 Thread David Winsemius
Dr Sorkin; You are a smart person. Why are you unable to create a working example that would allow testing of the code structure? On Jan 1, 2010, at 10:27 PM, John Sorkin wrote: coeffs <- matrix(nrow=10, ncol=3) dimnames(coeffs) < -list(NULL,c("BMI","BMIsq","min")) # set row counter n<-0

[R] Help with tryCatch

2010-01-01 Thread John Sorkin
Windows XP R 2.8.1 Colleagues, I am trying to run a function testone() and if the function completes without error do one set of instructions, and if the function generates either a warning or an error run another set of instructions. I have read try, and tryCatch help screens at least 20 times