From: Bernd Weiss <bernd.weiss@uni-koeln.de>
To: emacs-orgmode@gnu.org
Subject: [Babel][R] buffer-wide and code block specific use of :session
Date: Sat, 12 Feb 2011 09:47:19 -0500 [thread overview]
Message-ID: <4D569D77.4020005@uni-koeln.de> (raw)
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
next reply other threads:[~2011-02-12 14:47 UTC|newest]
Thread overview: 3+ messages / expand[flat|nested] mbox.gz Atom feed top
2011-02-12 14:47 Bernd Weiss [this message]
2011-02-12 18:30 ` [Babel][R] buffer-wide and code block specific use of :session Dan Davison
2011-02-12 20:42 ` Bernd Weiss
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
List information: https://www.orgmode.org/
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=4D569D77.4020005@uni-koeln.de \
--to=bernd.weiss@uni-koeln.de \
--cc=emacs-orgmode@gnu.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
Code repositories for project(s) associated with this public inbox
https://git.savannah.gnu.org/cgit/emacs/org-mode.git
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).