Ideas for improving ob-R (was: [FR] Org babel: mixing multiple outputs (was: Output of R code block: only text or plot but not both? And only one "result" can be output?))

2024-06-07 Thread Ihor Radchenko
"Berry, Charles" writes: >> Thanks for sharing the project! >> Although, I would not call going through double export, and producing >> html output "easier time". >> > > The `easier' part is that knitr/Rmarkdown requires very little markup > to produce nice documents in various formats (pdf, htm

Re: Output of R code block: only text or plot but not both? And only one "result" can be output?

2024-06-07 Thread Giuseppe Pagnoni
Ok, I just found out! You need to close the device after each plot: #+begin_src R :results output raw drawer :dir ./ x <- rnorm(100) print(mean(x)) png(file="hist1.png") hist(x) dev.off() png(file="hist2.png") hist(x^2) dev.off() print("[[./hist1.png]]") print("[[./hist2.png]]

Re: Output of R code block: only text or plot but not both? And only one "result" can be output?

2024-06-07 Thread Giuseppe Pagnoni
Same... no file gets written... On Fri, Jun 7, 2024 at 11:18 AM Ihor Radchenko wrote: > Giuseppe Pagnoni writes: > > > Sorry, I just sent you the reply that was meant for Berry's advice :-). > > Your suggestion also looks very useful, but somehow the png files do not > > get saved (in the curre

Re: Output of R code block: only text or plot but not both? And only one "result" can be output?

2024-06-07 Thread Ihor Radchenko
Giuseppe Pagnoni writes: > Sorry, I just sent you the reply that was meant for Berry's advice :-). > Your suggestion also looks very useful, but somehow the png files do not > get saved (in the current directory or elsewhere), and I actually do not > get any error messages in the R buffer (I also

Re: Output of R code block: only text or plot but not both? And only one "result" can be output?

2024-06-07 Thread Giuseppe Pagnoni
Sorry, I just sent you the reply that was meant for Berry's advice :-). Your suggestion also looks very useful, but somehow the png files do not get saved (in the current directory or elsewhere), and I actually do not get any error messages in the R buffer (I also tried to change the file type to j

Re: Output of R code block: only text or plot but not both? And only one "result" can be output?

2024-06-07 Thread Giuseppe Pagnoni
Many thanks. Since I am using this within an org-mode notebook, I think the :session trick works well enough for me. best giuseppe On Wed, Jun 5, 2024 at 8:35 PM Ihor Radchenko wrote: > Giuseppe Pagnoni writes: > > > #+begin_src R :file example.png :results output graphics file > > x <- rno

Re: [FR] Org babel: mixing multiple outputs (was: Output of R code block: only text or plot but not both? And only one "result" can be output?)

2024-06-05 Thread Berry, Charles
> On Jun 5, 2024, at 11:17 AM, Ihor Radchenko wrote: > > "Berry, Charles" writes: > >>> I am trying to have an R code block output both the results of a numerical >>> expression AND a plot, but if I set up the header arguments to display the >>> plot, the numerical outcome is not displayed.

Re: Output of R code block: only text or plot but not both? And only one "result" can be output?

2024-06-05 Thread Ihor Radchenko
Giuseppe Pagnoni writes: > #+begin_src R :file example.png :results output graphics file > x <- rnorm(100) > print(mean(x)) > hist(x) > hist(x^2) > #+end_src > > Here, only the last plot gets displayed. Is it not possible to display > more than 1 plot? We currently do not have automatic

[FR] Org babel: mixing multiple outputs (was: Output of R code block: only text or plot but not both? And only one "result" can be output?)

2024-06-05 Thread Ihor Radchenko
"Berry, Charles" writes: >> I am trying to have an R code block output both the results of a numerical >> expression AND a plot, but if I set up the header arguments to display the >> plot, the numerical outcome is not displayed. A simple example: >> >> #+begin_src R :file example.png :result

Re: Output of R code block: only text or plot but not both? And only one "result" can be output?

2024-06-05 Thread Berry, Charles
Giuseppe, > On Jun 3, 2024, at 6:47 AM, Giuseppe Pagnoni wrote: > > Hi, > > I am trying to have an R code block output both the results of a numerical > expression AND a plot, but if I set up the header arguments to display the > plot, the numerical outcome is not displayed. A simple examp

Output of R code block: only text or plot but not both? And only one "result" can be output?

2024-06-05 Thread Giuseppe Pagnoni
Hi, I am trying to have an R code block output both the results of a numerical expression AND a plot, but if I set up the header arguments to display the plot, the numerical outcome is not displayed. A simple example: #+begin_src R :file example.png :results output graphics file x <- rnorm(100