[R] Help with tryCatch

eric ericstrom at aol.com
Mon Jul 11 00:59:11 CEST 2011


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 while I figure out how to solve the tryCatch problem). So
doing an "if else" for each variable seems like a lot of code. i'm thinking
there must be a better way.

What I'm doing here is setting up a dataframe full of addresses and then
looking up data for each address on the web. Things seem to go well until
one of the addresses I have is not valid. When that happens, the data I'm
looking for (e.g. zest, bed, bath, sqft ...etc) does not seem to get set to
NA.

Note that the code works fine until about the 4th iteration when I run into
an invalid address and I get the replacement has length 0 error.

Any ideas how I can fix this so it works right without adding lots of
if-else-else code ?
http://r.789695.n4.nabble.com/file/n3658347/code.sher.pdf code.sher.pdf 

--
View this message in context: http://r.789695.n4.nabble.com/Help-with-tryCatch-tp3657859p3658347.html
Sent from the R help mailing list archive at Nabble.com.



More information about the R-help mailing list