How to exit R script gracefully on error

613 views
Skip to first unread message

RapacheLover

unread,
Jun 9, 2011, 11:42:21 AM6/9/11
to rapache
All,

How do I exit R script on error without running the rest of the code
after the error

a<<-as.character(POST$BenchMarkSettings);

if (length(a) == 0 || is.null(a) || str == ''){stop("No
BenchMarkSettings Data");}

more code....... (which I don't want to execute if the above error
occurs)

Thanks.

JDennison

unread,
Jul 21, 2011, 5:31:52 PM7/21/11
to rapache
I think you could do variable validation in the html before the r code
starts or you could look at ?try.

This could also give you ideas

http://www.r-bloggers.com/r-web-application-%E2%80%93-%E2%80%9Chello-world%E2%80%9D-using-rapache-7min-video-tutorial/
Reply all
Reply to author
Forward
0 new messages