emacs-orgmode
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [O] extract a region from a table and export it


From: John Kitchin
Subject: Re: [O] extract a region from a table and export it
Date: Thu, 16 Jun 2016 13:23:24 -0400
User-agent: mu4e 0.9.16; emacs 25.1.50.1

(require 'dash)
#+tblname: tab2
| 1 | a | 3 |
| 2 | b | 4 |
| 3 | c | 6 |
| 4 | d | 7 |

#+BEGIN_SRC emacs-lisp :var c0=tab2[,0] :var c2=tab2[,2]
(-zip-with 'list c0 c2)
#+END_SRC

#+RESULTS:
| 1 | 3 |
| 2 | 4 |
| 3 | 6 |
| 4 | 7 |



Uwe Brauer writes:

>    > Uwe Brauer <address@hidden> writes:
>
>    > See (info "(org) var") in particular the section on "Indexable variable
>    > values".
>
>
>    >         Additionally, an empty index, or the single character ‘*’, are 
> both
>    >      interpreted to mean the entire range and as such are equivalent to
>    >      ‘0:-1’, as shown in the following example in which the entire first
>    >      column is referenced.
>
>    >           #+NAME: example-table
>    >           | 1 | a |
>
>    >           | 2 | b |
>    >           | 3 | c |
>    >           | 4 | d |
>
>    >           #+BEGIN_SRC emacs-lisp :var data=example-table[,0]
>    >             data
>    >           #+END_SRC
>
>    >           #+RESULTS:
>    >           | 1 | 2 | 3 | 4 |
>
> It is also not clear to me how you could extract say the first and the
> third column from the following table
>
> | 1 | a | 3 |
> | 2 | b | 4 |
> | 3 | c | 6 |
> | 4 | d | 7 |
>
> Using your approach?


-- 
Professor John Kitchin
Doherty Hall A207F
Department of Chemical Engineering
Carnegie Mellon University
Pittsburgh, PA 15213
412-268-7803
@johnkitchin
http://kitchingroup.cheme.cmu.edu



reply via email to

[Prev in Thread] Current Thread [Next in Thread]