From mboxrd@z Thu Jan 1 00:00:00 1970 From: Matthew Landis Subject: Re: Selectively export RESULTS Date: Fri, 02 Mar 2012 13:53:48 -0500 Message-ID: <4F51173C.5010308@isciences.com> References: <87ty2aw7ps.fsf@tajo.ucsd.edu> <87ty29eg8n.fsf@tajo.ucsd.edu> <87boohbmch.fsf@gmx.com> <8762epz8uh.fsf@tajo.ucsd.edu> <874nu6lw91.fsf@xtof-netbook.home> Mime-Version: 1.0 Content-Type: text/plain; charset=UTF-8; format=flowed Content-Transfer-Encoding: 7bit Return-path: Received: from eggs.gnu.org ([208.118.235.92]:46940) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1S3XcJ-00035z-RX for emacs-orgmode@gnu.org; Fri, 02 Mar 2012 13:54:13 -0500 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1S3Xbz-0003Jr-HQ for emacs-orgmode@gnu.org; Fri, 02 Mar 2012 13:54:11 -0500 Received: from mail-vx0-f169.google.com ([209.85.220.169]:60489) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1S3Xbz-0003HB-DU for emacs-orgmode@gnu.org; Fri, 02 Mar 2012 13:53:51 -0500 Received: by vcbfk14 with SMTP id fk14so2064773vcb.0 for ; Fri, 02 Mar 2012 10:53:48 -0800 (PST) In-Reply-To: <874nu6lw91.fsf@xtof-netbook.home> List-Id: "General discussions about Org-mode." List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: emacs-orgmode-bounces+geo-emacs-orgmode=m.gmane.org@gnu.org Sender: emacs-orgmode-bounces+geo-emacs-orgmode=m.gmane.org@gnu.org To: Christophe Pouzat Cc: emacs-orgmode@gnu.org On 3/2/2012 12:59 PM, Christophe Pouzat wrote: > > Matthew, > > I think that you're wrongly expecting babel's cache header argument to > behave like the argument of the same name in Sweave code chunks. Babel > will cache, in your case, the value of your code block evaluation and > there is none in your first code block, therefore nothing gets cached by > babel, try that instead: > > #+name: my-random-vector > #+begin_src R :session :cache yes > rnorm(100) > #+end_src > > #+headers: :var x=my-random-vector > #+headers: :results graphics :exports results :file hist.png > #+begin_src R :session :cache yes > hist(x) > #+end_src > > Does it work better? In that case you don't even need a session. > > Christophe Christophe - thanks for the suggestion. I haven't messed around much with variables passed between code blocks. When I try this, R tells me that 'x' must be numeric. When I query x in the R buffer, x is a data.frame. So the second code block reads x in as a data.frame instead of a numeric vector. For most purposes this would be OK (since a data.frame is the most usual outcome), but I'm reluctant to use this approach -- I'd like all of the variable passing to be in the R session. Intuitively this seems simpler, less error prone, and more conducive to tangling later. (Of course, I could be totally wrong - since I haven't really tried that approach). M -- ~~~~~~~~~~~~~~~~~~~~~~~~~~ Matthew Landis, Ph.D. Research Scientist ISciences, LLC 61 Main St. Suite 200 Burlington VT 05401 802.864.2999 www.isciences.com ~~~~~~~~~~~~~~~~~~~~~~~~~~