* extract a region from a table and export it
@ 2016-06-14 10:44 Uwe Brauer
2016-06-14 11:14 ` Philip Hudson
2016-06-14 11:19 ` John Kitchin
0 siblings, 2 replies; 23+ messages in thread
From: Uwe Brauer @ 2016-06-14 10:44 UTC (permalink / raw)
To: emacs-orgmode
Hi
Is it possible to extract just say two regions from a huge table and
convert it to say CSV?
Uwe Brauer
^ permalink raw reply [flat|nested] 23+ messages in thread
* Re: extract a region from a table and export it
2016-06-14 10:44 extract a region from a table and export it Uwe Brauer
@ 2016-06-14 11:14 ` Philip Hudson
2016-06-14 11:19 ` John Kitchin
1 sibling, 0 replies; 23+ messages in thread
From: Philip Hudson @ 2016-06-14 11:14 UTC (permalink / raw)
To: emacs orgmode-mailinglist
On 14 June 2016 at 11:44, Uwe Brauer <oub@mat.ucm.es> wrote:
> Is it possible to extract just say two regions from a huge table and
> convert it to say CSV?
Yes. Anything you can think of is possible in Emacs. Usually in two or
more different ways. :-)
Presumably you want to automate this to make it quickly repeatable.
Please show us some sample table rows and explain the criteria you
would want to use to identify which regions to extract.
--
Phil Hudson http://hudson-it.ddns.net
@UWascalWabbit PGP/GnuPG ID: 0x887DCA63
^ permalink raw reply [flat|nested] 23+ messages in thread
* Re: extract a region from a table and export it
2016-06-14 10:44 extract a region from a table and export it Uwe Brauer
2016-06-14 11:14 ` Philip Hudson
@ 2016-06-14 11:19 ` John Kitchin
2016-06-14 12:13 ` Uwe Brauer
2016-06-14 12:17 ` Uwe Brauer
1 sibling, 2 replies; 23+ messages in thread
From: John Kitchin @ 2016-06-14 11:19 UTC (permalink / raw)
To: Uwe Brauer; +Cc: emacs-orgmode
can you write a little code block that filters the table for what you
want, and then convert that to a pdf?
Something like:
#+tblname: data
| 1 | a |
| 2 | r |
| 5 | 7 |
| 4 | 9 |
| 8 | y |
#+BEGIN_SRC emacs-lisp :var d=data
(orgtbl-to-csv (-filter (lambda (x) (and (> (car x) 2) (< (car x) 8))) d) nil)
#+END_SRC
#+RESULTS:
: 5,7
: 4,9
or, rows 0, 1 and 4.
#+BEGIN_SRC emacs-lisp :var d=data
(loop for i in '(0 1 4) collect (elt d i))
#+END_SRC
#+RESULTS:
| 1 | a |
| 2 | r |
| 8 | y |
Uwe Brauer writes:
> Hi
>
> Is it possible to extract just say two regions from a huge table and
> convert it to say CSV?
>
> Uwe Brauer
--
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
^ permalink raw reply [flat|nested] 23+ messages in thread
* Re: extract a region from a table and export it
2016-06-14 11:19 ` John Kitchin
@ 2016-06-14 12:13 ` Uwe Brauer
2016-06-14 12:17 ` Uwe Brauer
1 sibling, 0 replies; 23+ messages in thread
From: Uwe Brauer @ 2016-06-14 12:13 UTC (permalink / raw)
To: emacs-orgmode
>>> "John" == John Kitchin <jkitchin@andrew.cmu.edu> writes:
Hi John,
> can you write a little code block that filters the table for what you
> want, and then convert that to a pdf?
Great! Thanks a lot. This is a brilliant idea, on a second thought I
would even say that I don't need orgtbl-to-csv, but I just want to
extract 3 columns of a table which contains 10. What would the relevant
syntax be for column, please?
This way I have a poor-man's database (basically I need that for the
grades of my students).
> Something like:
> #+tblname: data
> | 1 | a |
> | 2 | r |
> | 5 | 7 |
> | 4 | 9 |
> | 8 | y |
> #+BEGIN_SRC emacs-lisp :var d=data
> (orgtbl-to-csv (-filter (lambda (x) (and (> (car x) 2) (< (car x) 8))) d) nil)
> #+END_SRC
I obtain an error when I run your code (but of them, namely)
(but I am using a very recent version of org mode)
,----
|
| Debugger entered--Lisp error: (wrong-type-argument listp "nil")
| -filter((lambda (x) (and (> (car x) 2) (< (car x) 8))) "nil")
| (orgtbl-to-csv (-filter (lambda (x) (and (> (car x) 2) (< (car x) 8)))
| d) nil) (let ((d (quote "nil"))) (orgtbl-to-csv (-filter (lambda (x)
| (and (> (car x) 2) (< (car x) 8))) d) nil)) (progn (let ((d (quote
| "nil"))) (orgtbl-to-csv (-filter (lambda (x) (and (> (car x) 2) (<
| (car x) 8))) d) nil))) eval((progn (let ((d (quote "nil")))
| (orgtbl-to-csv (-filter (lambda (x) (and (> (car x) 2) (< (car x) 8)))
| d) nil)))) org-babel-execute:emacs-lisp("(orgtbl-to-csv (-filter
| (lambda (x) (and (> (car x) 2) (< (car x) 8))) d) nil)" ((:comments .
| "") (:shebang . "") (:cache . "no") (:padline . "") (:noweb . "no")
| (:tangle . "no") (:exports . "code") (:results . "replace") (:var d .
| "nil") (:session . "none") (:hlines . "no") (:result-type . value)
| (:result-params "replace") (:rowname-names) (:colname-names)))
| org-babel-execute-src-block(nil) org-babel-execute-src-block-maybe()
| org-babel-execute-maybe() org-babel-execute-safely-maybe()
| run-hook-with-args-until-success(org-babel-execute-safely-maybe)
| org-ctrl-c-ctrl-c(nil) funcall-interactively(org-ctrl-c-ctrl-c nil)
| call-interactively(org-ctrl-c-ctrl-c nil nil)
| command-execute(org-ctrl-c-ctrl-c)
`----
What could the problem?
Thanks again!
Uwe
^ permalink raw reply [flat|nested] 23+ messages in thread
* Re: extract a region from a table and export it
2016-06-14 11:19 ` John Kitchin
2016-06-14 12:13 ` Uwe Brauer
@ 2016-06-14 12:17 ` Uwe Brauer
2016-06-14 12:42 ` John Kitchin
2016-06-14 16:12 ` Rasmus
1 sibling, 2 replies; 23+ messages in thread
From: Uwe Brauer @ 2016-06-14 12:17 UTC (permalink / raw)
To: emacs-orgmode
>>> "John" == John Kitchin <jkitchin@andrew.cmu.edu> writes:
> or, rows 0, 1 and 4.
> #+BEGIN_SRC emacs-lisp :var d=data
> (loop for i in '(0 1 4) collect (elt d i))
> #+END_SRC
Ok the second code works now, and is almost what I want, but I need it
mostly for columns, it is not obvious for me that corresponds in the
syntax above to columns.
> #+RESULTS:
> | 1 | a |
> | 2 | r |
> | 8 | y |
> Uwe Brauer writes:
>> Hi
>>
>> Is it possible to extract just say two regions from a huge table and
>> convert it to say CSV?
>>
>> Uwe Brauer
^ permalink raw reply [flat|nested] 23+ messages in thread
* Re: extract a region from a table and export it
2016-06-14 12:17 ` Uwe Brauer
@ 2016-06-14 12:42 ` John Kitchin
2016-06-14 13:10 ` Uwe Brauer
2016-06-14 16:12 ` Rasmus
1 sibling, 1 reply; 23+ messages in thread
From: John Kitchin @ 2016-06-14 12:42 UTC (permalink / raw)
To: Uwe Brauer; +Cc: emacs-orgmode
How about:
#+tblname: grades
| | H1 | H2 | H3 |
|----+----+----+----|
| P1 | 90 | 89 | 91 |
| P2 | 67 | 65 | 78 |
| P3 | 99 | 98 | 97 |
collect row 0 and 2, columns 0 (P) and 2 (H2)
#+BEGIN_SRC emacs-lisp :var data=grades
(loop for i in '(0 2)
with row = nil
do
(setq row (nth i data))
collect (list (nth 0 row) (nth 2 row)))
#+END_SRC
#+RESULTS:
| P1 | 89 |
| P3 | 98 |
Uwe Brauer writes:
>>>> "John" == John Kitchin <jkitchin@andrew.cmu.edu> writes:
>
>
>
> > or, rows 0, 1 and 4.
>
> > #+BEGIN_SRC emacs-lisp :var d=data
> > (loop for i in '(0 1 4) collect (elt d i))
> > #+END_SRC
>
> Ok the second code works now, and is almost what I want, but I need it
> mostly for columns, it is not obvious for me that corresponds in the
> syntax above to columns.
>
>
> > #+RESULTS:
> > | 1 | a |
> > | 2 | r |
> > | 8 | y |
>
>
>
>
> > Uwe Brauer writes:
>
> >> Hi
> >>
> >> Is it possible to extract just say two regions from a huge table and
> >> convert it to say CSV?
> >>
> >> Uwe Brauer
--
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
^ permalink raw reply [flat|nested] 23+ messages in thread
* Re: extract a region from a table and export it
2016-06-14 12:17 ` Uwe Brauer
2016-06-14 12:42 ` John Kitchin
@ 2016-06-14 16:12 ` Rasmus
2016-06-16 16:12 ` Uwe Brauer
2016-06-16 16:16 ` Uwe Brauer
1 sibling, 2 replies; 23+ messages in thread
From: Rasmus @ 2016-06-14 16:12 UTC (permalink / raw)
To: emacs-orgmode
Uwe Brauer <oub@mat.ucm.es> writes:
>>>> "John" == John Kitchin <jkitchin@andrew.cmu.edu> writes:
>
>
>
> > or, rows 0, 1 and 4.
>
> > #+BEGIN_SRC emacs-lisp :var d=data
> > (loop for i in '(0 1 4) collect (elt d i))
> > #+END_SRC
>
> Ok the second code works now, and is almost what I want, but I need it
> mostly for columns, it is not obvious for me that corresponds in the
> syntax above to columns.
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 |
--
If you can mix business and politics wonderful things can happen!
^ permalink raw reply [flat|nested] 23+ messages in thread
* Re: extract a region from a table and export it
2016-06-14 16:12 ` Rasmus
@ 2016-06-16 16:12 ` Uwe Brauer
2016-06-16 17:18 ` John Kitchin
2016-06-16 16:16 ` Uwe Brauer
1 sibling, 1 reply; 23+ messages in thread
From: Uwe Brauer @ 2016-06-16 16:12 UTC (permalink / raw)
To: emacs-orgmode
> Uwe Brauer <oub@mat.ucm.es> 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 |
Thanks that looks like a very simple solution, however how can one
obtain the first column of the table in column format? (I know I could
transverse it, but just out of curiosity.
^ permalink raw reply [flat|nested] 23+ messages in thread
* Re: extract a region from a table and export it
2016-06-16 16:12 ` Uwe Brauer
@ 2016-06-16 17:18 ` John Kitchin
2016-06-17 8:59 ` Uwe Brauer
0 siblings, 1 reply; 23+ messages in thread
From: John Kitchin @ 2016-06-16 17:18 UTC (permalink / raw)
To: Uwe Brauer; +Cc: emacs-orgmode
#+BEGIN_SRC emacs-lisp :var data=example-table[,0]
(mapcar 'list data)
#+END_SRC
#+RESULTS:
| 1 |
| 2 |
| 3 |
| 4 |
Uwe Brauer writes:
> > Uwe Brauer <oub@mat.ucm.es> 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 |
>
> Thanks that looks like a very simple solution, however how can one
> obtain the first column of the table in column format? (I know I could
> transverse it, but just out of curiosity.
--
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
^ permalink raw reply [flat|nested] 23+ messages in thread
* Re: extract a region from a table and export it
2016-06-14 16:12 ` Rasmus
2016-06-16 16:12 ` Uwe Brauer
@ 2016-06-16 16:16 ` Uwe Brauer
2016-06-16 17:23 ` John Kitchin
1 sibling, 1 reply; 23+ messages in thread
From: Uwe Brauer @ 2016-06-16 16:16 UTC (permalink / raw)
To: emacs-orgmode
> Uwe Brauer <oub@mat.ucm.es> 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?
^ permalink raw reply [flat|nested] 23+ messages in thread
* Re: extract a region from a table and export it
2016-06-16 16:16 ` Uwe Brauer
@ 2016-06-16 17:23 ` John Kitchin
2016-06-17 9:01 ` Uwe Brauer
0 siblings, 1 reply; 23+ messages in thread
From: John Kitchin @ 2016-06-16 17:23 UTC (permalink / raw)
To: Uwe Brauer; +Cc: emacs-orgmode
(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 <oub@mat.ucm.es> 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
^ permalink raw reply [flat|nested] 23+ messages in thread
* Re: extract a region from a table and export it
2016-06-16 17:23 ` John Kitchin
@ 2016-06-17 9:01 ` Uwe Brauer
2016-06-17 11:03 ` John Kitchin
0 siblings, 1 reply; 23+ messages in thread
From: Uwe Brauer @ 2016-06-17 9:01 UTC (permalink / raw)
To: emacs-orgmode
[-- Attachment #1: Type: text/plain, Size: 480 bytes --]
>>> "John" == John Kitchin <jkitchin@andrew.cmu.edu> writes:
> (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
That does not work for me (I loaded dash)
Here is the backtrace
I also deleted the "-" in (-zip-with 'list c0 c2) to obtain
(zip-with 'list c0 c2), but zip-with is not known as a command.
[-- Attachment #2: error-zip.txt --]
[-- Type: text/plain, Size: 1071 bytes --]
Debugger entered--Lisp error: (wrong-type-argument listp "nil")
-zip-with(list "nil" "nil")
(let ((c0 (quote "nil")) (c2 (quote "nil"))) (-zip-with (quote list) c0 c2))
(progn (let ((c0 (quote "nil")) (c2 (quote "nil"))) (-zip-with (quote list) c0 c2)))
eval((progn (let ((c0 (quote "nil")) (c2 (quote "nil"))) (-zip-with (quote list) c0 c2))))
org-babel-execute:emacs-lisp("(-zip-with 'list c0 c2)" ((:comments . "") (:shebang . "") (:cache . "no") (:padline . "") (:noweb . "no") (:tangle . "no") (:exports . "code") (:results . "replace") (:var c0 . "nil") (:var c2 . "nil") (:session . "none") (:hlines . "no") (:result-type . value) (:result-params "replace") (:rowname-names) (:colname-names)))
org-babel-execute-src-block(nil)
org-babel-execute-src-block-maybe()
org-babel-execute-maybe()
org-babel-execute-safely-maybe()
run-hook-with-args-until-success(org-babel-execute-safely-maybe)
org-ctrl-c-ctrl-c(nil)
funcall-interactively(org-ctrl-c-ctrl-c nil)
call-interactively(org-ctrl-c-ctrl-c nil nil)
command-execute(org-ctrl-c-ctrl-c)
^ permalink raw reply [flat|nested] 23+ messages in thread
* Re: extract a region from a table and export it
2016-06-17 9:01 ` Uwe Brauer
@ 2016-06-17 11:03 ` John Kitchin
2016-06-17 11:34 ` Rasmus
2016-06-17 13:07 ` Uwe Brauer
0 siblings, 2 replies; 23+ messages in thread
From: John Kitchin @ 2016-06-17 11:03 UTC (permalink / raw)
To: Uwe Brauer; +Cc: emacs-orgmode
the problem seems to be that c0 and c2 are set to nil for some reason. I
doubt dash has anything to do with it. Try these:
#+BEGIN_SRC emacs-lisp :var c0=tab2[,0] :var c2=tab2[,2]
c0
#+END_SRC
#+RESULTS:
| 1 | 2 | 3 | 4 |
#+BEGIN_SRC emacs-lisp :var c0=tab2[,0] :var c2=tab2[,2]
c2
#+END_SRC
#+RESULTS:
| 3 | 4 | 6 | 7 |
Here is a non-dash solution that works for two lists.
#+BEGIN_SRC emacs-lisp :var c0=tab2[,0] :var c2=tab2[,2]
(loop for a in c0 for b in c2 collect (list a b))
#+END_SRC
#+RESULTS:
| 1 | 3 |
| 2 | 4 |
| 3 | 6 |
| 4 | 7 |
Uwe Brauer writes:
>>>> "John" == John Kitchin <jkitchin@andrew.cmu.edu> writes:
>
> > (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
>
> That does not work for me (I loaded dash)
>
> Here is the backtrace
> I also deleted the "-" in (-zip-with 'list c0 c2) to obtain
> (zip-with 'list c0 c2), but zip-with is not known as a command.
--
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
^ permalink raw reply [flat|nested] 23+ messages in thread
* Re: extract a region from a table and export it
2016-06-17 11:03 ` John Kitchin
@ 2016-06-17 11:34 ` Rasmus
2016-06-17 13:08 ` Uwe Brauer
2016-06-17 13:07 ` Uwe Brauer
1 sibling, 1 reply; 23+ messages in thread
From: Rasmus @ 2016-06-17 11:34 UTC (permalink / raw)
To: emacs-orgmode
John Kitchin <jkitchin@andrew.cmu.edu> writes:
D> the problem seems to be that c0 and c2 are set to nil for some reason. I
> doubt dash has anything to do with it. Try these:
>
> #+BEGIN_SRC emacs-lisp :var c0=tab2[,0] :var c2=tab2[,2]
> c0
> #+END_SRC
>
>
> #+RESULTS:
> | 1 | 2 | 3 | 4 |
>
> #+BEGIN_SRC emacs-lisp :var c0=tab2[,0] :var c2=tab2[,2]
> c2
> #+END_SRC
>
>
> #+RESULTS:
> | 3 | 4 | 6 | 7 |
>
> Here is a non-dash solution that works for two lists.
>
> #+BEGIN_SRC emacs-lisp :var c0=tab2[,0] :var c2=tab2[,2]
> (loop for a in c0 for b in c2 collect (list a b))
> #+END_SRC
Or
#+BEGIN_SRC emacs-lisp :var c0=tab2[,0] :var c2=tab2[,2]
(cl-mapcar 'list c0 c2)
#+END_SRC
--
This message is brought to you by the department of redundant departments
^ permalink raw reply [flat|nested] 23+ messages in thread
* Re: extract a region from a table and export it
2016-06-17 11:34 ` Rasmus
@ 2016-06-17 13:08 ` Uwe Brauer
2016-06-17 13:42 ` Rasmus
` (2 more replies)
0 siblings, 3 replies; 23+ messages in thread
From: Uwe Brauer @ 2016-06-17 13:08 UTC (permalink / raw)
To: emacs-orgmode
> John Kitchin <jkitchin@andrew.cmu.edu> writes:
D> the problem seems to be that c0 and c2 are set to nil for some reason. I
> Or
> #+BEGIN_SRC emacs-lisp :var c0=tab2[,0] :var c2=tab2[,2]
> (cl-mapcar 'list c0 c2)
> #+END_SRC
Thanks but I obtain
#+RESULTS:
| 110 | 110 |
| 105 | 105 |
| 108 | 108 |
Which is wrong.
^ permalink raw reply [flat|nested] 23+ messages in thread
* Re: extract a region from a table and export it
2016-06-17 13:08 ` Uwe Brauer
@ 2016-06-17 13:42 ` Rasmus
2016-06-17 13:42 ` Rasmus
2016-06-17 13:47 ` John Kitchin
2 siblings, 0 replies; 23+ messages in thread
From: Rasmus @ 2016-06-17 13:42 UTC (permalink / raw)
To: emacs-orgmode
Uwe Brauer <oub@mat.ucm.es> writes:
> > John Kitchin <jkitchin@andrew.cmu.edu> writes:
> D> the problem seems to be that c0 and c2 are set to nil for some reason. I
>
> > Or
>
> > #+BEGIN_SRC emacs-lisp :var c0=tab2[,0] :var c2=tab2[,2]
> > (cl-mapcar 'list c0 c2)
> > #+END_SRC
>
> Thanks but I obtain
>
> #+RESULTS:
> | 110 | 110 |
> | 105 | 105 |
> | 108 | 108 |
>
> Which is wrong.
Incidentally,
(mapcar 'string-to-char '("n" "i" "l")) => (110 105 108)
Probably your references are not right. E.g. in Org-8.2 this file would
produce your observed result.
#+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]
(cl-mapcar 'list c0 c2)
#+END_SRC
--
A clever person solves a problem. A wise person avoids it
^ permalink raw reply [flat|nested] 23+ messages in thread
* Re: extract a region from a table and export it
2016-06-17 13:08 ` Uwe Brauer
2016-06-17 13:42 ` Rasmus
@ 2016-06-17 13:42 ` Rasmus
2016-06-17 17:26 ` Uwe Brauer
2016-06-17 13:47 ` John Kitchin
2 siblings, 1 reply; 23+ messages in thread
From: Rasmus @ 2016-06-17 13:42 UTC (permalink / raw)
To: emacs-orgmode
Uwe Brauer <oub@mat.ucm.es> writes:
> > John Kitchin <jkitchin@andrew.cmu.edu> writes:
> D> the problem seems to be that c0 and c2 are set to nil for some reason. I
>
> > Or
>
> > #+BEGIN_SRC emacs-lisp :var c0=tab2[,0] :var c2=tab2[,2]
> > (cl-mapcar 'list c0 c2)
> > #+END_SRC
>
> Thanks but I obtain
>
> #+RESULTS:
> | 110 | 110 |
> | 105 | 105 |
> | 108 | 108 |
>
> Which is wrong.
Incidentally,
(mapcar 'string-to-char '("n" "i" "l")) => (110 105 108)
Probably your references are not right. E.g. in Org-8.2 this file would
produce your observed result.
#+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]
(cl-mapcar 'list c0 c2)
#+END_SRC
--
A clever person solves a problem. A wise person avoids it
^ permalink raw reply [flat|nested] 23+ messages in thread
* Re: extract a region from a table and export it
2016-06-17 13:42 ` Rasmus
@ 2016-06-17 17:26 ` Uwe Brauer
0 siblings, 0 replies; 23+ messages in thread
From: Uwe Brauer @ 2016-06-17 17:26 UTC (permalink / raw)
To: emacs-orgmode
>>> "Rasmus" == Rasmus <rasmus@gmx.us> writes:
> Uwe Brauer <oub@mat.ucm.es> writes:
>> > John Kitchin <jkitchin@andrew.cmu.edu> writes:
D> the problem seems to be that c0 and c2 are set to nil for some reason. I
>>
>> > Or
>>
>> > #+BEGIN_SRC emacs-lisp :var c0=tab2[,0] :var c2=tab2[,2]
>> > (cl-mapcar 'list c0 c2)
>> > #+END_SRC
>>
>> Thanks but I obtain
>>
>> #+RESULTS:
>> | 110 | 110 |
>> | 105 | 105 |
>> | 108 | 108 |
>>
>> Which is wrong.
> Incidentally,
> (mapcar 'string-to-char '("n" "i" "l")) => (110 105 108)
> Probably your references are not right. E.g. in Org-8.2 this file would
> produce your observed result.
I am using org 8.3.5 so this is a bug of version 8.3.5?
^ permalink raw reply [flat|nested] 23+ messages in thread
* Re: extract a region from a table and export it
2016-06-17 13:08 ` Uwe Brauer
2016-06-17 13:42 ` Rasmus
2016-06-17 13:42 ` Rasmus
@ 2016-06-17 13:47 ` John Kitchin
2016-06-17 17:25 ` Uwe Brauer
2 siblings, 1 reply; 23+ messages in thread
From: John Kitchin @ 2016-06-17 13:47 UTC (permalink / raw)
To: emacs-orgmode@gnu.org
[-- Attachment #1: Type: text/plain, Size: 769 bytes --]
Those look like characters somehow to me. What org version are you using?
and what emacs?
John
-----------------------------------
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
On Fri, Jun 17, 2016 at 9:08 AM, Uwe Brauer <oub@mat.ucm.es> wrote:
>
> > John Kitchin <jkitchin@andrew.cmu.edu> writes:
> D> the problem seems to be that c0 and c2 are set to nil for some
> reason. I
>
> > Or
>
> > #+BEGIN_SRC emacs-lisp :var c0=tab2[,0] :var c2=tab2[,2]
> > (cl-mapcar 'list c0 c2)
> > #+END_SRC
>
> Thanks but I obtain
>
> #+RESULTS:
> | 110 | 110 |
> | 105 | 105 |
> | 108 | 108 |
>
> Which is wrong.
>
>
>
[-- Attachment #2: Type: text/html, Size: 1521 bytes --]
^ permalink raw reply [flat|nested] 23+ messages in thread
* Re: extract a region from a table and export it
2016-06-17 11:03 ` John Kitchin
2016-06-17 11:34 ` Rasmus
@ 2016-06-17 13:07 ` Uwe Brauer
1 sibling, 0 replies; 23+ messages in thread
From: Uwe Brauer @ 2016-06-17 13:07 UTC (permalink / raw)
To: emacs-orgmode
Thanks but none works for me
in the following I will show my results
#+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]
c0
#+END_SRC
#+RESULTS:
: nil
I obtain
#+BEGIN_SRC emacs-lisp :var c0=tab2[,0] :var c2=tab2[,2]
c2
#+END_SRC
#+RESULTS:
: nil
> Here is a non-dash solution that works for two lists.
#+BEGIN_SRC emacs-lisp :var c0=tab2[,0] :var c2=tab2[,2]
(loop for a in c0 for b in c2 collect (list a b))
#+END_SRC
#+RESULTS:
^ permalink raw reply [flat|nested] 23+ messages in thread
end of thread, other threads:[~2016-06-17 17:30 UTC | newest]
Thread overview: 23+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2016-06-14 10:44 extract a region from a table and export it Uwe Brauer
2016-06-14 11:14 ` Philip Hudson
2016-06-14 11:19 ` John Kitchin
2016-06-14 12:13 ` Uwe Brauer
2016-06-14 12:17 ` Uwe Brauer
2016-06-14 12:42 ` John Kitchin
2016-06-14 13:10 ` Uwe Brauer
2016-06-14 16:12 ` Rasmus
2016-06-16 16:12 ` Uwe Brauer
2016-06-16 17:18 ` John Kitchin
2016-06-17 8:59 ` Uwe Brauer
2016-06-16 16:16 ` Uwe Brauer
2016-06-16 17:23 ` John Kitchin
2016-06-17 9:01 ` Uwe Brauer
2016-06-17 11:03 ` John Kitchin
2016-06-17 11:34 ` Rasmus
2016-06-17 13:08 ` Uwe Brauer
2016-06-17 13:42 ` Rasmus
2016-06-17 13:42 ` Rasmus
2016-06-17 17:26 ` Uwe Brauer
2016-06-17 13:47 ` John Kitchin
2016-06-17 17:25 ` Uwe Brauer
2016-06-17 13:07 ` Uwe Brauer
Code repositories for project(s) associated with this external index
https://git.savannah.gnu.org/cgit/emacs.git
https://git.savannah.gnu.org/cgit/emacs/org-mode.git
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.