I have an R source code blocks called with the ":results value” option. I evaluate the code with C-c. When I do that, in my R session buffer, I get to see several + + + until the final value is obtained, and then the final value is shown, and inserted in my Org buffer. I was wondering if there is an option somewhere that will allow me to instead see how each line in my R source code is evaluated. That is, the R session buffer should show each line being evaluated, and then show the final value as usual. Vikas
Hello, Vikas Rawal writes: > I have an R source code blocks called with the ":results value” > option. I evaluate the code with C-c. When I do that, in my R session > buffer, I get to see several + + + until the final value is obtained, > and then the final value is shown, and inserted in my Org buffer. > > I was wondering if there is an option somewhere that will allow me to > instead see how each line in my R source code is evaluated. That is, > the R session buffer should show each line being evaluated, and then > show the final value as usual. Look at: http://orgmode.org/worg/org-contrib/babel/languages/ob-doc-R.html Use ESS to step through evaluation line-by-line Use C-c ' to visit the edit buffer for your code block Use ess-eval-line-and-step to evaluate each line in turn ess-eval-line-and-step is usually bound to C-c C-n I guess that is possible to use the same R session by configuring the session arguments and/or the ESS settings but I have not done it yet. If you do not have ESS you can try a more lightweight solution with isend-mode. Best, Daniele
On 13-Dec-2014, at 3:42 pm, Daniele Pizzolli <dan@toel.it> wrote:
> Look at:
> http://orgmode.org/worg/org-contrib/babel/languages/ob-doc-R.html
>
> Use ESS to step through evaluation line-by-line
>
> Use C-c ' to visit the edit buffer for your code block
> Use ess-eval-line-and-step to evaluate each line in turn
>
> ess-eval-line-and-step is usually bound to C-c C-n
I know this and use it. But since my code evaluation is quite resource intensive, when I later evaluate the code using C-c C-c to insert results in my org buffer, it would be useful to see how far it is progressing.
Vikas
Hi Vikas, 2014ko abenudak 13an, Vikas Rawal-ek idatzi zuen: > > On 13-Dec-2014, at 3:42 pm, Daniele Pizzolli <dan@toel.it> wrote: >> Look at: >> http://orgmode.org/worg/org-contrib/babel/languages/ob-doc-R.html >> >> Use ESS to step through evaluation line-by-line >> >> Use C-c ' to visit the edit buffer for your code block >> Use ess-eval-line-and-step to evaluate each line in turn >> >> ess-eval-line-and-step is usually bound to C-c C-n > > I know this and use it. But since my code evaluation is quite resource > intensive, when I later evaluate the code using C-c C-c to insert > results in my org buffer, it would be useful to see how far it is > progressing. See the thread beginning at <http://mid.gmane.org/8638cfr7ua.fsf@somewhere.org>. I’m not sure this feature is actually workable, however, even aside from the performance issues alluded to in that thread. There are various methods that babel uses to evaluate R code, not all of which are amenable to line-by-line echoing. In the future, I think babel should move towards an approach which separates the code actually evaluated in R from the contents of the code block further. (See my patch at <http://mid.gmane.org/87wqa9owhv.fsf@gmail.com> for an example of what I mean). This will make line-by-line echoing confusing (since what would be echoed has little relation to the actual code). If enough people really want it, the let-binding around ess-eval-visibly-p in ob-R.el can be removed, but IMO there should be an understanding that: 1) This won’t make all evaluation echo line-by-line. 2) Preserving line-by-line echoing mustn’t be allowed to block the evolution of other features that are incompatible with it. For your use case, I would suggest adding print() calls in strategic places in your long-running code, which will appear in the R buffer to let you know how it’s progressing. -- Aaron Ecay
[-- Attachment #1: Type: text/plain, Size: 318 bytes --] > > > For your use case, I would suggest adding print() calls in strategic > places in your long-running code, which will appear in the R buffer to > let you know how it’s progressing. > I don’t quite understand everything you wrote. But this would be helpful for my test case. Will use. Thanks. Vikas [-- Attachment #2: Type: text/html, Size: 1250 bytes --]
Hi Vikas,
Vikas Rawal <vikaslists@agrarianresearch.org> writes:
>
>
>
> For your use case, I would suggest adding print() calls in
> strategic
> places in your long-running code, which will appear in the R
> buffer to
> let you know how it’s progressing.
>
>
>
> I don’t quite understand everything you wrote. But this would be
> helpful for my test case. Will use.
>
> Thanks.
>
> Vikas
I am joining late. I suspect that this can be configured on the ESS
side rather than on orgmode's side.
Take a look at ess-eval-visibly (but beware the performance loss).
Andreas
Hi, I stand corrected. (Should test before I send...) Here is a reply I received from Ista which -- I think -- did not make it to the list: On Tue, Dec 16, 2014 at 11:32 AM, Andreas Leha <andreas.leha@med.uni-goettingen.de> wrote: > Hi Vikas, > > > Vikas Rawal <vikaslists@agrarianresearch.org> writes: >> >> >> >> For your use case, I would suggest adding print() calls in >> strategic >> places in your long-running code, which will appear in the R >> buffer to >> let you know how it’s progressing. >> >> >> >> I don’t quite understand everything you wrote. But this would be >> helpful for my test case. Will use. >> >> Thanks. >> >> Vikas > > I am joining late. I suspect that this can be configured on the ESS > side rather than on orgmode's side. > > Take a look at ess-eval-visibly (but beware the performance loss). I thought so too, but I don't think that's the case. This affects how org-babel behaves with :results output, but not the behavior with :results value. At least that's the case here with org 8.2.10 Running these two examples: #+BEGIN_SRC R :results value :session *R* a <- 1 b <- 2 print(a + b) #+END_SRC #+RESULTS: : 3 #+BEGIN_SRC R :results output :session *R* a <- 1 b <- 2 print(a + b) #+END_SRC #+RESULTS: : [1] 3 I see >> + + [1] 3 >> for the first one and > a <- 1 b <- 2 print(a + b) 'org_babel_R_eoe' a <- 1 > b <- 2 > print(a + b) [1] 3 > 'org_babel_R_eoe' [1] "org_babel_R_eoe" > for the second one. I have ess-eval-visibly set to t. Best, Ista