Here's what I would expect:

In interactive mode, input is taken from the user (i.e. command line).
In non-interactive mode, input is taken from a text file (or equivalent).

What you're trying to do is run R in *non*-interactive mode, and call
the browser function.
This requires input to come from the user (i.e. command line) and from
a text file (or equivalent), at essentially the same time.

While doing fantasmoswankyblastik things with I/O is a lot of fun.
I don't think it's R's job to do that.


On Fri, Feb 21, 2020 at 6:25 PM <frede...@ofb.net> wrote:
>
> I would like to have a mode where I can run some R code in an executable 
> script, like with Rscript, but interactively, so that e.g. 'browser()' works.
>
>  From the manual page it looks like this should work:
>
>      R --interactive -e 'source("script.R")'
>
> or we could shorten it to:
>
>      R --interactive -e 'browser()'
>
> However, it seems that --interactive causes -e to be ignored.
>
> And if I leave out --interactive, then R quits before the browser() function 
> exits.
>
>  From an engineering standpoint it doesn't seem like it should be very 
> difficult to tell the interactive REPL to pretend that a certain command was 
> entered before everything else. Also, it would be useful to me to be able to 
> debug R scripts using standard features like 'browser()'. Should I submit a 
> feature request on Bugzilla, or maybe someone can advise me how to proceed?
>
> Thanks,
>
> Frederick
>
> ______________________________________________
> R-devel@r-project.org mailing list
> https://stat.ethz.ch/mailman/listinfo/r-devel

______________________________________________
R-devel@r-project.org mailing list
https://stat.ethz.ch/mailman/listinfo/r-devel

Reply via email to