From mboxrd@z Thu Jan 1 00:00:00 1970 From: Rasmus Subject: Re: [ob-R] combine :post and :colnames Date: Mon, 26 Jan 2015 18:31:22 +0100 Message-ID: <871tmhcutx.fsf@gmx.us> References: <87egqiy4sz.fsf@gmx.us> <877fwah7r0.fsf@gmail.com> <87a916y15l.fsf@gmx.us> <874mrege0y.fsf@gmail.com> Mime-Version: 1.0 Content-Type: multipart/mixed; boundary="=-=-=" Return-path: Received: from eggs.gnu.org ([2001:4830:134:3::10]:51132) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1YFnVe-0006TQ-HM for emacs-orgmode@gnu.org; Mon, 26 Jan 2015 12:31:35 -0500 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1YFnVa-00080s-Ci for emacs-orgmode@gnu.org; Mon, 26 Jan 2015 12:31:34 -0500 Received: from mout.gmx.net ([212.227.15.15]:62432) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1YFnVa-00080d-43 for emacs-orgmode@gnu.org; Mon, 26 Jan 2015 12:31:30 -0500 Received: from x200s ([109.201.154.183]) by mail.gmx.com (mrgmx001) with ESMTPSA (Nemesis) id 0M3iU5-1XPLJK3HZR-00rL7o for ; Mon, 26 Jan 2015 18:31:24 +0100 In-Reply-To: <874mrege0y.fsf@gmail.com> (Aaron Ecay's message of "Mon, 26 Jan 2015 03:08:29 -0500") 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 --=-=-= Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: quoted-printable Hi, Aaron Ecay writes: > 2015ko urtarrilak 25an, Rasmus-ek idatzi zuen: >> Should add a note on this to the manual? Or is it clear enough as it >> is? > > I think it would be a good idea to add a note about this in the manual. > Perhaps in the form of another example in the node for the :post header > argument (info "(org) post") which shows how to use :post to process a > tabular result. I'm a bit busy right now, but here's a quick proposal. If you are happy with it, I'll push it. =E2=80=94Rasmus --=20 With monopolies the cake is a lie! --=-=-= Content-Type: text/x-diff Content-Disposition: inline; filename=0001-org.texi-New-example-on-babel-post-header.patch >From 721926ad040c3bf0d46660bdbf2543ea9645b3aa Mon Sep 17 00:00:00 2001 From: rasmus Date: Mon, 26 Jan 2015 18:24:39 +0100 Subject: [PATCH] org.texi: New example on babel :post header * org.texi (post): Clarification and new example. --- doc/org.texi | 32 +++++++++++++++++++++++++++++--- 1 file changed, 29 insertions(+), 3 deletions(-) diff --git a/doc/org.texi b/doc/org.texi index 65c9309..defd015 100644 --- a/doc/org.texi +++ b/doc/org.texi @@ -15979,10 +15979,11 @@ code block execution. When a post argument is given, the results of the code block will temporarily be bound to the @code{*this*} variable. This variable may then be included in header argument forms such as those used in @ref{var} header argument specifications allowing passing of results to other code -blocks, or direct execution via Emacs Lisp. +blocks, or direct execution via Emacs Lisp. Additional header arguments may +be passed to the @code{:post}-function. -The following example illustrates the usage of the @code{:post} header -argument. +The following two examples illustrate the usage of the @code{:post} header +argument. The first example shows how to attach a attribute-line via @code{:post}. @example #+name: attr_wrap @@ -16007,6 +16008,31 @@ argument. :END: @end example +The second examples shows how to use @code{:post} together with the +@code{:colnames} header argument. +@example +#+name: round-tbl +#+begin_src emacs-lisp :var tbl="" fmt="%.3f" + (mapcar (lambda (row) + (mapcar (lambda (cell) + (if (numberp cell) + (format fmt cell) + cell)) + row)) + tbl) +#+end_src + +#+begin_src R :colnames yes :post round-tbl[:colnames yes](*this*) +set.seed(42) +data.frame(foo=rnorm(1)) +#+end_src + +#+RESULTS: +| foo | +|-------| +| 1.371 | +@end example + @node prologue @subsubsection @code{:prologue} @cindex @code{:prologue}, src header argument -- 2.2.2 --=-=-=--