ivo welch
2006-Jul-11 01:57 UTC
[R] --no-save and --save toggle from inside R? + BATCH stderr
dear R wizards: is it possible to instruct R to save or no-save from inside R? or does this have to be given at invokation on the command-line? The same question applies to "--no-restore-data", although this presumably would have to be decided in a .First() function or something like it. on a similar note, I would love a CMD BATCH invokation to output just one line to stderr at the end of its run which tells me whether the batch job ended prematurely because of an error. I know this can be undesirable if run in another program that refuses output (e.g., a web browser, where this can cause havoc if issued before the content-type:), so it would require that some switch like --silent would suppress this one line summary/error. This is not urgent---I can use the R return code to write a wrapper for this facility, but this might be nice default behavior. My guess is that most of us won't mind to see a flag in writing if something went badly wrong. sincerely, /iaw
Duncan Murdoch
2006-Jul-11 02:45 UTC
[R] --no-save and --save toggle from inside R? + BATCH stderr
ivo welch wrote:> dear R wizards: is it possible to instruct R to save or no-save from > inside R?You can specify the action when you call q() or quit(), but you can't change the default action.> or does this have to be given at invokation on the > command-line? The same question applies to "--no-restore-data", > although this presumably would have to be decided in a .First() > function or something like it. >This one can't currently be changed. Duncan Murdoch> on a similar note, I would love a CMD BATCH invokation to output just > one line to stderr at the end of its run which tells me whether the > batch job ended prematurely because of an error. I know this can be > undesirable if run in another program that refuses output (e.g., a web > browser, where this can cause havoc if issued before the > content-type:), so it would require that some switch like --silent > would suppress this one line summary/error. This is not urgent---I > can use the R return code to write a wrapper for this facility, but > this might be nice default behavior. My guess is that most of us > won't mind to see a flag in writing if something went badly wrong. > > sincerely, > > /iaw > > ______________________________________________ > R-help at stat.math.ethz.ch mailing list > https://stat.ethz.ch/mailman/listinfo/r-help > PLEASE do read the posting guide! http://www.R-project.org/posting-guide.html >
ivo welch
2006-Jul-11 13:25 UTC
[R] --no-save and --save toggle from inside R? + BATCH stderr
thank you. exactly what I needed. can I add it as a suggestion for the next R version to add an option to quit that prints only one line to stderr (or stdout, but the real one, not the batch output one) that gives a 1-line job summary---"no error" (or nothing), "5 warnings", "5 warnings, fatal error: blah". except in rare circumstances, this is likely to be the user-preferred behavior. (taking a hand where I have gotten a finger---can I redefine a quit function that can invoke the original quit() with an option?) regards, /iaw
ivo welch
2006-Jul-11 14:01 UTC
[R] --no-save and --save toggle from inside R? + BATCH stderr
the following diff to the shell script invoking R prints an error message if R terminates with an error code: 112c112,119 < exec sh "${R_HOME}/bin/Rcmd" "${@}" ;; ---> sh "${R_HOME}/bin/Rcmd" "${@}" > rc="$?" > if [ "$rc" -ne 0 ]; then > shift ; > echo "${@}: Error Return Code: $rc" > fi > exit $? > ;;regards, /iaw