From mboxrd@z Thu Jan 1 00:00:00 1970 From: "Loris Bennett" Subject: Referring to results rather than code block Date: Mon, 19 May 2014 16:11:29 +0200 Message-ID: <87iop1eu3y.fsf@hornfels.zedat.fu-berlin.de> Mime-Version: 1.0 Content-Type: text/plain Return-path: Received: from eggs.gnu.org ([2001:4830:134:3::10]:51064) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1WmOID-0006oi-5M for emacs-orgmode@gnu.org; Mon, 19 May 2014 10:12:01 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1WmOI4-00085i-OW for emacs-orgmode@gnu.org; Mon, 19 May 2014 10:11:53 -0400 Received: from plane.gmane.org ([80.91.229.3]:48352) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1WmOI4-00084q-HS for emacs-orgmode@gnu.org; Mon, 19 May 2014 10:11:44 -0400 Received: from list by plane.gmane.org with local (Exim 4.69) (envelope-from ) id 1WmOI3-0007QS-6e for emacs-orgmode@gnu.org; Mon, 19 May 2014 16:11:43 +0200 Received: from hornfels.zedat.fu-berlin.de ([160.45.11.110]) by main.gmane.org with esmtp (Gmexim 0.1 (Debian)) id 1AlnuQ-0007hv-00 for ; Mon, 19 May 2014 16:11:43 +0200 Received: from loris.bennett by hornfels.zedat.fu-berlin.de with local (Gmexim 0.1 (Debian)) id 1AlnuQ-0007hv-00 for ; Mon, 19 May 2014 16:11:43 +0200 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: emacs-orgmode@gnu.org Hi, I have a code block like this #+NAME: users_per_month #+HEADER: :results append #+BEGIN_SRC sh :dir /root@sadmin: sacct=/cm/shared/apps/slurm/current/bin/sacct for y in {2014..2014}; do for m in {03..04}; do month=$y-$m first=$y-$m-01 last=`date -d "$first + 1 month - 1 day" +"%Y-%m-%d"` n=`$sacct -S $first -E $last -o user -X -n | sort | uniq | wc -l` echo $month $n done done #+END_SRC which produces something like this #+RESULTS: users_per_month | 2012-01 | 1 | | 2012-02 | 10 | | 2012-03 | 100 | | 2012-04 | 1000 | I'm using append because the generation of a datapoint takes a while. I'd like to plot the data with something like: #+NAME: plot_users_per_month #+HEADER: var data=users_per_month #+HEADER: :results output graphics #+HEADER: :file ./users_per_month.pdf :exports both #+HEADER: :session *r* #+BEGIN_SRC R library(ggplot2) bar_colour <- "#69B4D8" # steely blue month <- data$V1 users <- data$V2 df <- data.frame(month,users) p <- ggplot(df,aes(x=month,y=users)) + geom_bar(stat="identity",alpha=0.5,fill=bar_colour) + xlab("date") + ylab("users") p #+END_SRC However, this is just generating a plot of the data generated by the source block and not of the total results table. Can I give the results block a different name to the source block, so that I can refer to it directly, or should I be doing something completely different? Cheers, Loris -- This signature is currently under construction.