From mboxrd@z Thu Jan 1 00:00:00 1970 From: Bernd Weiss Subject: [Babel][R] buffer-wide and code block specific use of :session Date: Sat, 12 Feb 2011 09:47:19 -0500 Message-ID: <4D569D77.4020005@uni-koeln.de> Mime-Version: 1.0 Content-Type: text/plain; charset=ISO-8859-15; format=flowed Content-Transfer-Encoding: 7bit Return-path: Received: from [140.186.70.92] (port=42637 helo=eggs.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1PoGky-0006pi-LS for emacs-orgmode@gnu.org; Sat, 12 Feb 2011 09:47:29 -0500 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1PoGkw-0005Qg-Tv for emacs-orgmode@gnu.org; Sat, 12 Feb 2011 09:47:28 -0500 Received: from smtp-out.rrz.uni-koeln.de ([134.95.19.53]:56288) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1PoGkw-0005Pm-Ji for emacs-orgmode@gnu.org; Sat, 12 Feb 2011 09:47:26 -0500 Received: from smtp-auth.rrz.uni-koeln.de (smtp-auth.rrz.uni-koeln.de [134.95.19.93]) by smtp-out.rrz.uni-koeln.de (8.13.8/8.13.8) with ESMTP id p1CElMDQ014434 for ; Sat, 12 Feb 2011 15:47:23 +0100 Received: from [10.0.0.3] ([199.44.252.34]) (authenticated as user ahf34 using CRAM-MD5 bits=0) by smtp-auth.uni-koeln.de (8.13.8/8.13.8) with ESMTP id p1CElLUU022161 (version=TLSv1/SSLv3 cipher=AES256-SHA bits=256 verify=NO) for ; Sat, 12 Feb 2011 15:47:22 +0100 List-Id: "General discussions about Org-mode." List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Sender: emacs-orgmode-bounces+geo-emacs-orgmode=m.gmane.org@gnu.org Errors-To: emacs-orgmode-bounces+geo-emacs-orgmode=m.gmane.org@gnu.org To: emacs-orgmode@gnu.org 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