From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mp0 ([2001:41d0:2:4a6f::]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits)) by ms11 with LMTPS id eLDXMbz+dV8uHgAA0tVLHw (envelope-from ) for ; Thu, 01 Oct 2020 16:07:24 +0000 Received: from aspmx1.migadu.com ([2001:41d0:2:4a6f::]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits)) by mp0 with LMTPS id aCKYLbz+dV9+JwAA1q6Kng (envelope-from ) for ; Thu, 01 Oct 2020 16:07:24 +0000 Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by aspmx1.migadu.com (Postfix) with ESMTPS id A7859940142 for ; Thu, 1 Oct 2020 16:07:23 +0000 (UTC) Received: from localhost ([::1]:38450 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1kO173-0003cL-TF for larch@yhetil.org; Thu, 01 Oct 2020 12:07:21 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:60286) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1kO0oG-00023y-UI for emacs-orgmode@gnu.org; Thu, 01 Oct 2020 11:47:57 -0400 Received: from mail-wr1-x42d.google.com ([2a00:1450:4864:20::42d]:40692) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1kO0oE-00050s-Mb for emacs-orgmode@gnu.org; Thu, 01 Oct 2020 11:47:56 -0400 Received: by mail-wr1-x42d.google.com with SMTP id j2so6374845wrx.7 for ; Thu, 01 Oct 2020 08:47:51 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=andrew-cmu-edu.20150623.gappssmtp.com; s=20150623; h=mime-version:references:in-reply-to:from:date:message-id:subject:to :cc; bh=B2w6KasHlVuNN3tJUib+oWqHVK+cu1aJCZBQoScm1OI=; b=XC7b2UxZDsEYDibFziy8fspS6e2O1U7Uw9NW0H8EVMQr8N4ApeAyFbcgPysWmQRTyw 0dd77tjhsbz/jioQB/MScmCMe81oDyMJfHlXV5CwGvw37dIjSPQKE6lhNE5ZOD5myjZx E7uHEp1sfhA0VJEFsmRleUeIjUG/4gHFbknLahgqP4sQacomOF7O+8l0CFIAJZTA+0ZA biu1FdhaM2EYqqXOpxi7h1f7rYgkhMPkSh6l4LBIX0Fv557n/nuOl3aMRbDFG4WlL/mp /EYfWzsSOjHIP+jBqCb7oFATw/FUjsQglDOGIyJfbMgrDonvD8khAF+nDn3iURnc2EEY oQqQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:mime-version:references:in-reply-to:from:date :message-id:subject:to:cc; bh=B2w6KasHlVuNN3tJUib+oWqHVK+cu1aJCZBQoScm1OI=; b=XS+qOIEX8V0v2Ql0GWvjj+CwDbLseCuvNI1CDeVF2xgbejIXD/UUezquC81I09JGBi vjI0IYCPGqclAutV9LWf3uCUT7QWVqtcwEwGUH/7lX394IQ5hv8lYTfEkkABa3T7OSy3 wBr/TxP8RDDXwacAVS+nfBCs9G+dLI0Wvs8PtEjoU+0jC5KOAngzidI++Gv1I8F4mQl+ 6FB09qRmOxxVRf90Fqk4o81Blp/u6CrrhUqC0LOaXLZdp1MbV16cMkQms7G8/fpUHNyv DrooOBFPXYOJYoZKjOqzV909itxo7vbrw3VotZGHdWFVAvJxOdHJbXe+aN0XwJNbv5+x Hnmg== X-Gm-Message-State: AOAM530AV7Mh8PWlR94UJV+cUxy0kKy26VaGYjJaZ7TWWWp58hkVhhgn IoOndFLkgpIsOu+neI/QydaISBi5leCSJM1b33WdIJPg2DE= X-Google-Smtp-Source: ABdhPJy4v31MsMpJFcwqRpM1NQwKt9IHPms6LJY/wV6wFZMz/c4iVoBYHZfiJqA09LHlLZW/iPQ2OCqYbNzom0vaiPk= X-Received: by 2002:adf:f88b:: with SMTP id u11mr9416054wrp.376.1601567270493; Thu, 01 Oct 2020 08:47:50 -0700 (PDT) MIME-Version: 1.0 References: <65644810-71B5-412C-9E13-ADC15CA80CF6@axelkielhorn.de> <3CB77DC4-121C-43D9-A814-16FB1DE307B1@axelkielhorn.de> In-Reply-To: <3CB77DC4-121C-43D9-A814-16FB1DE307B1@axelkielhorn.de> From: John Kitchin Date: Thu, 1 Oct 2020 11:47:39 -0400 Message-ID: Subject: Re: Two tables with same data but different sorting To: Axel Kielhorn Content-Type: multipart/alternative; boundary="0000000000003de09f05b09df0e5" Received-SPF: pass client-ip=2a00:1450:4864:20::42d; envelope-from=johnrkitchin@gmail.com; helo=mail-wr1-x42d.google.com X-detected-operating-system: by eggs.gnu.org: No matching host in p0f cache. That's all we know. X-Spam_score_int: -15 X-Spam_score: -1.6 X-Spam_bar: - X-Spam_report: (-1.6 / 5.0 requ) BAYES_00=-1.9, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, FREEMAIL_FORGED_FROMDOMAIN=0.001, FREEMAIL_FROM=0.001, HEADER_FROM_DIFFERENT_DOMAINS=0.25, HTML_MESSAGE=0.001, RCVD_IN_DNSWL_NONE=-0.0001, SPF_HELO_NONE=0.001, SPF_PASS=-0.001 autolearn=no autolearn_force=no X-Spam_action: no action X-BeenThere: emacs-orgmode@gnu.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: "General discussions about Org-mode." List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: Org-Mode Mailing List Errors-To: emacs-orgmode-bounces+larch=yhetil.org@gnu.org Sender: "Emacs-orgmode" X-Scanner: scn0 Authentication-Results: aspmx1.migadu.com; dkim=pass header.d=andrew-cmu-edu.20150623.gappssmtp.com header.s=20150623 header.b=XC7b2UxZ; dmarc=fail reason="SPF not aligned (relaxed), DKIM not aligned (relaxed)" header.from=andrew.cmu.edu (policy=none); spf=pass (aspmx1.migadu.com: domain of emacs-orgmode-bounces@gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=emacs-orgmode-bounces@gnu.org X-Spam-Score: -0.11 X-TUID: Jotcq6Xk52Kn --0000000000003de09f05b09df0e5 Content-Type: text/plain; charset="UTF-8" Glad it was helpful. You might also try (seventh row1) or (nth 6 row1). I think it is the same thing, but more obvious to read! 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 Thu, Oct 1, 2020 at 10:37 AM Axel Kielhorn wrote: > > > > Am 01.10.2020 um 14:21 schrieb John Kitchin : > > > > You could do something like this: > > > > > > * Table 1 > > > > #+name: table1 > > | Manufacturer | Name | Price | > > |-----------------+-------------+-------| > > | ACME | super cheep | 25 $ | > > | Roadrunner Inc. | Kaboom | 27 $ | > > | ACME | cheep | 30 $ | > > > > #+RESULTS: resorted > > | Manufacturer | Name | Price | > > |-----------------+-------------+-------| > > | ACME | super cheep | 25 $ | > > | ACME | cheep | 30 $ | > > | Roadrunner Inc. | Kaboom | 27 $ | > > > > ** Code for resorting > > > > #+name: resorted > > #+BEGIN_SRC emacs-lisp :var data=table1 :colnames t > > (sort data (lambda (row1 row2) (string< (first row1) (first row2)))) > > #+END_SRC > > > > John > > > > Thanks John, this is really powerful. > > I changed =first row1= to =elt row1 6= since my real table is more complex. > > (Again I learned a little bit more about elisp.) > > Greetings > Axel > > > --0000000000003de09f05b09df0e5 Content-Type: text/html; charset="UTF-8" Content-Transfer-Encoding: quoted-printable
Glad it was helpful. You might also try (seventh row1) or = (nth 6 row1). I think it is the same thing, but more obvious to read!
<= br clear=3D"all">
John
-----------------------------------
Professor John Kitchin=C2=A0
Doh= erty Hall A207F
Department of Chemical Engineering
Carnegie Mellon Un= iversity
Pittsburgh, PA 15213
412-268-7803


On Thu, Oct 1, 2020 at 10:37 AM Axel Kielhorn <org-mode@axelkielhorn.de> wrote:


> Am 01.10.2020 um 14:21 schrieb John Kitchin <jkitchin@andrew.cmu.edu>:
>
> You could do something like this:
>
>
> * Table 1
>
> #+name: table1
> | Manufacturer=C2=A0 =C2=A0 | Name=C2=A0 =C2=A0 =C2=A0 =C2=A0 | Price = |
> |-----------------+-------------+-------|
> | ACME=C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 | super cheep | 25 $= =C2=A0 |
> | Roadrunner Inc. | Kaboom=C2=A0 =C2=A0 =C2=A0 | 27 $=C2=A0 |
> | ACME=C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 | cheep=C2=A0 =C2=A0 = =C2=A0 =C2=A0| 30 $=C2=A0 |
>
> #+RESULTS: resorted
> | Manufacturer=C2=A0 =C2=A0 | Name=C2=A0 =C2=A0 =C2=A0 =C2=A0 | Price = |
> |-----------------+-------------+-------|
> | ACME=C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 | super cheep | 25 $= =C2=A0 |
> | ACME=C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 | cheep=C2=A0 =C2=A0 = =C2=A0 =C2=A0| 30 $=C2=A0 |
> | Roadrunner Inc. | Kaboom=C2=A0 =C2=A0 =C2=A0 | 27 $=C2=A0 |
>
> ** Code for resorting
>
> #+name: resorted
> #+BEGIN_SRC emacs-lisp :var data=3Dtable1 :colnames t
> (sort data (lambda (row1 row2) (string< (first row1) (first row2)))= )
> #+END_SRC
>
> John
>

Thanks John, this is really powerful.

I changed =3Dfirst row1=3D to =3Delt row1 6=3D since my real table is more = complex.

(Again I learned a little bit more about elisp.)

Greetings
Axel


--0000000000003de09f05b09df0e5--