[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Orgmode] [Babel][R] buffer-wide and code block specific use of :session
From: |
Bernd Weiss |
Subject: |
[Orgmode] [Babel][R] buffer-wide and code block specific use of :session |
Date: |
Sat, 12 Feb 2011 09:47:19 -0500 |
User-agent: |
Mozilla/5.0 (Windows; U; Windows NT 6.1; de; rv:1.9.2.13) Gecko/20101207 Thunderbird/3.1.7 |
Org-mode version 7.4 (release_7.4.348.g6132)
Dear all,
I am preparing a document which contains text and R code/output. In
particular, I'd like to print out a (correlation) matrix. This is my
org-mode document (I intentionally have two code blocks):
#----------------------------------------------------------
#+ Does not work
#+BABEL: :session *R*
#+BEGIN_SRC R :results silent :tangle simcorrdata.R
cormat <- c(1.0, 0.2, 0.4,
0.2, 1.0, -0.3,
0.4, -0.3, 1.0)
cormat <- matrix(cormat, ncol = 3, byrow = TRUE)
#+END_SRC
So, the correlation matrix looks as follows:
#+BEGIN_SRC R :exports both :tangle simcorrdata.R
print(cormat)
#+END_SRC
#----------------------------------------------------------
Since I have two code blocks, I need to use :session. If I define
:session buffer-wide as
#+BABEL: :session *R*
then the matrix cormat is unknown within the second code block ("object
'cormat' not found"). However, if I specify :session for each code block
seperately then it works as expected.
#----------------------------------------------------------
#+ Does work
#+BEGIN_SRC R :session :results silent :tangle simcorrdata.R
cormat <- c(1.0, 0.2, 0.4,
0.2, 1.0, -0.3,
0.4, -0.3, 1.0)
cormat <- matrix(cormat, ncol = 3, byrow = TRUE)
#+END_SRC
So, the correlation matrix looks as follows:
#+BEGIN_SRC R :session :exports both :tangle simcorrdata.R
print(cormat)
#+END_SRC
#----------------------------------------------------------
Does this happen due to my poor understanding of the :session argument?
Or is this a bug?
Thanks for your help,
Bernd
- [Orgmode] [Babel][R] buffer-wide and code block specific use of :session,
Bernd Weiss <=