[R] executing R scripts - viewing results and errors
Duncan Murdoch
murdoch.duncan at gmail.com
Thu Sep 1 18:06:45 CEST 2011
On 01/09/2011 11:29 AM, aelmore wrote:
> Hi,
>
> For the first time, I am trying to call/run an R script from another
> program, passing parameters and results back and forth. I have been
> learning a little programming as I have progressed through the various
> projects I have been working on, but I haven't had any formal training and
> am now stumped. Specifically, how do you pass results and errors out of R
> so that you can debug?
>
> My R script works fine as a standalone. My Python script seems clean and
> isn't giving me any errors, but the R script isn't running. R is obviously
> not receiving the inputs because the run-time is zero for the R portion of
> my model execution. Since I haven't been able to figure out how to "see"
> into R, however, I am unable to figure out where the problem lies.
>
> Can anyone give me a leg up on how you can get at outputs and errors when
> you do this sort of batch execution?
>
> If it's of any help, I can send along the Python and R scripts, but since I
> don't know that it's really necessary for this sort of question I won't
> clutter the thread, up front.
If you are running batch scripts (as opposed to running interactively),
the basic debugging tool is to put lots of cat() and print() calls into
your code so that you can monitor things as they go. You might need to
write to a file to serve as a log of the run, if your Python code is
reading the standard output.
Duncan Murdoch
More information about the R-help
mailing list