[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: [O] join two or more tables
From: |
Uwe Brauer |
Subject: |
Re: [O] join two or more tables |
Date: |
Sun, 18 Aug 2019 10:31:04 +0200 |
User-agent: |
Gnus/5.13 (Gnus v5.13) Emacs/27.0.50 (gnu/linux) |
>>> "UB" == Uwe Brauer <address@hidden> writes:
> Hi
> I was googling this a bit, I found more complicated scenarios, but not
> how to join one or more tables.
> For example
> #+begin_src
> #+tblname: nut
> | type | Fiber | Sugar | Protein | Carb |
> |----------+-------+-------+---------+------|
> | eggplant | 2.5 | 3.2 | 0.8 | 8.6 |
> | tomatoe | 0.6 | 2.1 | 0.8 | 3.4 |
> | onion | 1.3 | 4.4 | 1.3 | 9.0 |
> | egg | 0 | 18.3 | 31.9 | 18.3 |
> #+tblname: nut2
> | type | Fiber | Sugar | Protein | Carb |
> |----------+-------+-------+---------+------|
> | rice | 0.2 | 0 | 1.5 | 16.0 |
> | bread | 0.7 | 0.7 | 3.3 | 16.0 |
> | orange | 3.1 | 11.9 | 1.3 | 17.6 |
> | banana | 2.1 | 9.9 | 0.9 | 18.5 |
> | tofu | 0.7 | 0.5 | 6.6 | 1.4 |
> | nut | 2.6 | 1.3 | 4.9 | 7.2 |
> | corn | 4.7 | 1.8 | 2.8 | 21.3 |
> #+end_src
> I want to generate a new table total-nuts, which is just a combination
> of the two tables, nuts and nuts2
> Uwe Brauer
I found a solution posted in
https://lists.gnu.org/archive/html/emacs-orgmode/2009-09/msg00919.html
However
** Elisp
#+tblname: tab1
| 1 | 2 | 3 |
| 7 | 8 | 9 |
#+tblname: tab2
| 4 | 5 | 6 |
| 10 | 11 | 12 |
Here's a solution in emacs lisp:
#+srcname: column-bind-elisp(a=tab1, b=tab2)
#+begin_src emacs-lisp
(mapcar* 'append a b)
#+end_src
column-bind-elisp
Does not exist any more.
Any ideas?
Uwe Brauer
smime.p7s
Description: S/MIME cryptographic signature