From mboxrd@z Thu Jan 1 00:00:00 1970 From: Nick Dokos Subject: Re: [Babel] Header arguments Date: Sat, 14 May 2011 00:04:02 -0400 Message-ID: <17631.1305345842@alphaville.dokosmarshall.org> References: Reply-To: nicholas.dokos@hp.com Return-path: Received: from eggs.gnu.org ([140.186.70.92]:52566) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1QL65a-000475-GH for emacs-orgmode@gnu.org; Sat, 14 May 2011 00:04:27 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1QL65Z-0006t5-CI for emacs-orgmode@gnu.org; Sat, 14 May 2011 00:04:26 -0400 Received: from vms173007pub.verizon.net ([206.46.173.7]:56026) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1QL65Z-0006t0-2R for emacs-orgmode@gnu.org; Sat, 14 May 2011 00:04:25 -0400 Received: from alphaville.dokosmarshall.org ([unknown] [173.76.32.106]) by vms173007.mailsrvcs.net (Sun Java(tm) System Messaging Server 7u2-7.02 32bit (built Apr 16 2009)) with ESMTPA id <0LL600H3X3AQ1SB0@vms173007.mailsrvcs.net> for emacs-orgmode@gnu.org; Fri, 13 May 2011 23:04:08 -0500 (CDT) In-reply-to: Message from tsd@tsdye.com (Thomas S. Dye) of "Fri, 13 May 2011 16:56:51 -1000." 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: "Thomas S. Dye" Cc: nicholas.dokos@hp.com, emacs-orgmode@gnu.org Thomas S. Dye wrote: > Aloha all, > > I have a little function that graphs two 14C dates (below). The data > are held in tables produced by a software package that I access on the > web. I read these into Org-mode and give them a #+tblname:, as shown > below. I'd like to have one function that will graph any number of tables > but I don't know how to package up the table references and get them > inside the function. If I put them in a table, they end up as strings > inside the function. > > I suspect I'm being thick about this. Can someone give me a pointer to > how this might be done? > > All the best, > Tom > > #+tblname: theta-one-no-rat > | cal BP | Posterior probability | > |--------+-----------------------| > | -1520 | 1.8353001633417145E-5 | > ... > > > **** Two dates > #+srcname: two-dated-events > #+header: :file ~/org/tsdye/two-dates.pdf > #+header: :var xlab="theta_1" > #+header: :var x=theta-one-no-rat > #+header: :var ylab="theta_4" > #+header: :var y=theta-four-no-rat > #+header: :width 6 :height 4 :results output graphics > #+begin_src R > library(ggplot2) > res <- data.frame(cal.BP=numeric(0),Posterior.probability=numeric(0),label=character(0)) > res <- rbind(res,cbind(x,label=rep(xlab,dim(x)[1]))) > res <- rbind(res,cbind(y,label=rep(ylab,dim(y)[1]))) > theme_set(theme_bw(base_size=11)) > g <- ggplot(res, aes(x=1950 + cal.BP, y=Posterior.probability)) > g + geom_bar(stat='identity') + xlab("Year AD") + > ylab("Probability") + facet_wrap(~ label) > #+end_src > In a similar situation, I was able to do it as follows: ,---- | #+srcname: org2cw | #+begin_src python :results output :exports none | s = "" | for row in table: | ...do something with row and modify s... | print s | | #+end_src | | #+call: org2cw(table=support.obs) :file support.obs.cwiki | | #+call: org2cw(table=support) :file support.cwiki | `---- Each #+call is given a different table as an argument: ,---- | #+tblname: support.obs | | | #+tblname: support |
`---- Note the role of ``table'' as the parameter name in the #+call:s and its use as a variable in the source block. HTH, Nick