RE: R code blocks in org version 9.5

2022-10-19 Thread Cook, Malcolm
> My R code blocks work fine in org 9.5. When I plot graph using base graphics 
> in session, it works fine. The problem is with lattice graphs. With below 
> header variables, code block works fine.
> 
> #+begin_src R :session *R* :results graphics file :file test.png
> library(lattice)
> print(histogram(rnorm(1)))
> #+end_src
> 
> But this does not work. Emacs hangs.
> 
> #+begin_src R :session *R* :results output graphics file :file test.png
> library(lattice)
> histogram(rnorm(1))
> #+end_src

In my hands, all combinations work with/without the `output` and with/without 
the `print`.

IMO, you should not want to include the print. 

Here is my environment:

Org mode version 9.5.2 (release_9.5.2-9-g7ba24c)

GNU Emacs 29.0.50 (build 1, x86_64-pc-linux-gnu, X toolkit, cairo
 version 1.15.12, Xaw3d scroll bars) of 2022-01-19

ESS version 18.10.3snapshot

R
sessionInfo()
R version 4.2.0 (2022-04-22)
Platform: x86_64-pc-linux-gnu (64-bit)
Running under: CentOS Linux 7 (Core)

Matrix products: default
BLAS:   /n/apps/CentOS7/install/r-4.2.0/lib64/R/lib/libRblas.so
LAPACK: /n/apps/CentOS7/install/r-4.2.0/lib64/R/lib/libRlapack.so

locale:
[1] C

attached base packages:
[1] stats graphics  grDevices utils datasets  methods   base 

other attached packages:
[1] lattice_0.20-45

loaded via a namespace (and not attached):
[1] compiler_4.2.0 grid_4.2.0


Re: R code blocks in org version 9.5

2022-10-19 Thread William Denton

On 19 October 2022, Naresh Gurbuxani wrote:


It seems that org 9.5 has simplified header arguments for R code blocks that 
use grid graphics.

Org 9.4 requires
:results output graphics file

Org 9.5 requires
:results output file

Do other users find the same change?


They both work for me, though I've never put "output" in such a block: I always 
use ":results graphics file".



Bill

--
William Denton
https://www.miskatonic.org/
Librarian, artist and licensed private investigator.
Toronto, Canada



Re: R code blocks in org version 9.5

2022-10-19 Thread Colin Baxter
> Naresh Gurbuxani  writes:

> It seems that org 9.5 has simplified header arguments for R code
> blocks that use grid graphics.

> Org 9.4 requires :results output graphics file

> Org 9.5 requires :results output file

> Do other users find the same change?

> Sent from my iPhone

>> On Oct 19, 2022, at 8:59 AM, Naresh Gurbuxani
>>  wrote:
>> 
>> Thanks to your suggestion, I was able to narrow down the problem.
>> 
>> My R code blocks work fine in org 9.5. When I plot graph using
>> base graphics in session, it works fine.  The problem is with
>> lattice graphs. With below header variables, code block works
>> fine.
>> 
>> #+begin_src R :session *R* :results graphics file :file test.png
>> library(lattice) print(histogram(rnorm(1))) #+end_src
>> 
>> But this does not work.  Emacs hangs.
>> 
>> #+begin_src R :session *R* :results output graphics file :file
>> test.png library(lattice) histogram(rnorm(1)) #+end_src
>> 
>> I can simply add print command to my code blocks.  Is there an
>> easier solution?

I'm afraid both your above examples work for me. I'm on emacs-29.0.50
and org-mode version 9.6-pre (release_9.5.5-995-g4b9aef)

Best wishes



Re: R code blocks in org version 9.5

2022-10-19 Thread Naresh Gurbuxani
It seems that org 9.5 has simplified header arguments for R code blocks that 
use grid graphics.

Org 9.4 requires
:results output graphics file

Org 9.5 requires
:results output file

Do other users find the same change?

Sent from my iPhone

> On Oct 19, 2022, at 8:59 AM, Naresh Gurbuxani  
> wrote:
> 
> Thanks to your suggestion, I was able to narrow down the problem.
> 
> My R code blocks work fine in org 9.5. When I plot graph using base graphics 
> in session, it works fine.  The problem is with lattice graphs. With below 
> header variables, code block works fine.
> 
> #+begin_src R :session *R* :results graphics file :file test.png
> library(lattice)
> print(histogram(rnorm(1)))
> #+end_src
> 
> But this does not work.  Emacs hangs.
> 
> #+begin_src R :session *R* :results output graphics file :file test.png
> library(lattice)
> histogram(rnorm(1))
> #+end_src
> 
> I can simply add print command to my code blocks.  Is there an easier 
> solution?
> 
> Naresh
> 
> Sent from my iPhone
> 
>>> On Oct 18, 2022, at 11:14 PM, William Denton  wrote:
>>> 
>>> On 18 October 2022, Naresh Gurbuxani wrote:
>>> 
>>> Recently I started using org version 9.5 with my init.el that worked well 
>>> for org 9.4
>>> 
>>> In org 9.5, I can run stand-alone R code blocks.  But when I try to run 
>>> them in a session, emacs hangs.
>> 
>> I haven't had any problems like that, and I use R session code blocks pretty 
>> much every day.  Can you narrow it down any?  Does even the most basic 
>> block, just adding 1 + 1, not work?  What about with emacs -Q?
>> 
>> 
>> Bill
>> 
>> --
>> William Denton
>> https://www.miskatonic.org/
>> Librarian, artist and licensed private investigator.
>> Toronto, Canada


Re: R code blocks in org version 9.5

2022-10-19 Thread Naresh Gurbuxani
Thanks to your suggestion, I was able to narrow down the problem.

My R code blocks work fine in org 9.5. When I plot graph using base graphics in 
session, it works fine.  The problem is with lattice graphs. With below header 
variables, code block works fine.

#+begin_src R :session *R* :results graphics file :file test.png
library(lattice)
print(histogram(rnorm(1)))
#+end_src

But this does not work.  Emacs hangs.

#+begin_src R :session *R* :results output graphics file :file test.png
library(lattice)
histogram(rnorm(1))
#+end_src

I can simply add print command to my code blocks.  Is there an easier solution?

Naresh

Sent from my iPhone

> On Oct 18, 2022, at 11:14 PM, William Denton  wrote:
> 
> On 18 October 2022, Naresh Gurbuxani wrote:
> 
>> Recently I started using org version 9.5 with my init.el that worked well 
>> for org 9.4
>> 
>> In org 9.5, I can run stand-alone R code blocks.  But when I try to run them 
>> in a session, emacs hangs.
> 
> I haven't had any problems like that, and I use R session code blocks pretty 
> much every day.  Can you narrow it down any?  Does even the most basic block, 
> just adding 1 + 1, not work?  What about with emacs -Q?
> 
> 
> Bill
> 
> --
> William Denton
> https://www.miskatonic.org/
> Librarian, artist and licensed private investigator.
> Toronto, Canada


Re: R code blocks in org version 9.5

2022-10-18 Thread William Denton

On 18 October 2022, Naresh Gurbuxani wrote:


Recently I started using org version 9.5 with my init.el that worked well for 
org 9.4

In org 9.5, I can run stand-alone R code blocks.  But when I try to run them in 
a session, emacs hangs.


I haven't had any problems like that, and I use R session code blocks pretty 
much every day.  Can you narrow it down any?  Does even the most basic block, 
just adding 1 + 1, not work?  What about with emacs -Q?



Bill

--
William Denton
https://www.miskatonic.org/
Librarian, artist and licensed private investigator.
Toronto, Canada



R code blocks in org version 9.5

2022-10-18 Thread Naresh Gurbuxani
Recently I started using org version 9.5 with my init.el that worked well for 
org 9.4

In org 9.5, I can run stand-alone R code blocks.  But when I try to run them in 
a session, emacs hangs.

Have you seen this problem? Is there a solution?

Thanks,
Naresh

Sent from my iPhone