From mboxrd@z Thu Jan 1 00:00:00 1970 From: Russell Adams Subject: Re: Re: org-babel-R export parameters Date: Mon, 7 Jun 2010 05:31:00 -0500 Message-ID: <20100607103100.GE13859@thinkpad.adamsinfoserv.com> References: <20100606225802.GC13859@thinkpad.adamsinfoserv.com> <87k4qbyc5p.fsf@stats.ox.ac.uk> <20100607080434.GD13859@thinkpad.adamsinfoserv.com> <871vcjp631.fsf@stats.ox.ac.uk> Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii Return-path: Received: from [140.186.70.92] (port=57028 helo=eggs.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1OLZbu-0006db-9g for emacs-orgmode@gnu.org; Mon, 07 Jun 2010 06:31:22 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.69) (envelope-from ) id 1OLZbp-0004z9-6B for emacs-orgmode@gnu.org; Mon, 07 Jun 2010 06:31:14 -0400 Received: from squirtle.drak.net ([72.52.144.201]:47876) by eggs.gnu.org with esmtp (Exim 4.69) (envelope-from ) id 1OLZbp-0004yy-1X for emacs-orgmode@gnu.org; Mon, 07 Jun 2010 06:31:09 -0400 Content-Disposition: inline In-Reply-To: <871vcjp631.fsf@stats.ox.ac.uk> 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: Dan Davison Cc: emacs-orgmode On Mon, Jun 07, 2010 at 10:03:46AM +0100, Dan Davison wrote: > Hi Russell, > > Thanks, that's clear. You may well be right that it would be appropriate > to expose further information about the babel source block > (e.g. the :file argument) to the external language. However, one general > design consideration is that where possible we do want to avoid > implementing ad-hoc language-specific behaviour. If we do go your route > I would suggest that everything should be wrapped up in a single list > object (hash in perl, dict in python, etc etc), and that that list/hash > object should have a reasonably consistent name across languages > (__org_babel_header_args__ or something). I already thought of that, but R was my target here. I didn't want to jump into a major design decision. ;] > For now however, I would suggest taking the view that what you are doing > is slightly non-standard org-babel usage, and therefore that it should > be achieved more explicitly. E.g. how about the following approach? > > #+begin_src R :results file :var basename="myplot" > a <- 1:4 > pngfile <- sprintf("%s.png", basename) > pdffile <- sprintf("%s.pdf", basename) > > png(pngfile) > plot(a) > dev.off() > > pdf(pdffile) > plot(a) > dev.off() > > pngfile > #+end_src I like this better, and I can use dev.copy here too. The issue is a plot is rarely one line. Most of my plots are a half page of code between the data set, legend, etc. ------------------------------------------------------------------ Russell Adams RLAdams@AdamsInfoServ.com PGP Key ID: 0x1160DCB3 http://www.adamsinfoserv.com/ Fingerprint: 1723 D8CA 4280 1EC9 557F 66E8 1154 E018 1160 DCB3