emacs-orgmode@gnu.org archives
 help / color / mirror / code / Atom feed
From: Darlan Cavalcante Moreira <darcamo@gmail.com>
To: emacs-orgmode@gnu.org
Subject: [org-babel] Feature request: Get a scalar for "data=example-table[0, 1]"
Date: Wed, 21 Apr 2010 16:37:07 +0200	[thread overview]
Message-ID: <y2q45c323461004210737y841f3cc4wd58cb9b4c1da809b@mail.gmail.com> (raw)

In the org-babel documentation we see that one can pass a single element
from a table to a babel source block with
,----
! :var data=example-table[0,1]
`----

I assumed that I would get a scalar value, but it seems that I still get a
table (but with only one element). For instance, if I have the table below

#+TBLNAME: MyTable
 |   X |  Y |
 |-----+----|
 |   0 |  0 |
 |   1 |  1 |
 |   2 |  4 |
 |   3 |  9 |
 |   4 | 16 |
 |   5 | 25 |
 |-----+----|
 | Sum | 55 |
 #+TBLFM: $2=$1*$1::@8$2=vsum(@2..@-1)

then the code in python to print the value of sum returns

,----
! #+begin_src python :var sum=MyTable[9,1] :results output :exports none
!    print sum
! #+end_src
!
! #+results:
! : [[55]]
`----

but I would expect to get only 55, since I'm getting a specific element in
MyTable and not a sub-table.

In addition, the hlines are being counted. Is this intended behaviour? I
remember that there is a thread in the list about keeping the hlines in
resulting tables, but even if that is desirable, counting the hlines as
lines will result in troubles (python give me an error if I use
sum=MyTable[9,1], for instance).


I was trying to plot the table with Org-Babel and Gnuplot with the code below

#+begin_src gnuplot :var data=MyTable[1:-2] :var sum=MyTable[7,1]
:results silent :exports none
  reset
  set label "Sum: %.0f",sum at graph 0.03, graph 0.93
  plot data with linespoints
#+end_src

but the sum variable will have the value of a temporary file with the
element [7,1] instead of the actual value. I could use ":var sum=55" but
then I would have to change this whenever I change the table.


- Darlan

ps: How do I do that "cute here start/end"? Is it gnus functionality (I use
wanderlust) or it is more general?

             reply	other threads:[~2010-04-21 14:37 UTC|newest]

Thread overview: 4+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2010-04-21 14:37 Darlan Cavalcante Moreira [this message]
2010-04-21 15:43 ` [org-babel] Feature request: Get a scalar for "data=example-table[0, 1]" Eric Schulte
2010-04-21 19:08   ` Darlan Cavalcante Moreira
2010-04-22 15:49   ` OT: message-mark-inserted-region WAS: " Dan Davison

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

  List information: https://www.orgmode.org/

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=y2q45c323461004210737y841f3cc4wd58cb9b4c1da809b@mail.gmail.com \
    --to=darcamo@gmail.com \
    --cc=emacs-orgmode@gnu.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
Code repositories for project(s) associated with this public inbox

	https://git.savannah.gnu.org/cgit/emacs/org-mode.git

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).