From mboxrd@z Thu Jan 1 00:00:00 1970 From: Thierry Banel Subject: Re: very long table calc expressions ? Date: Wed, 20 Jun 2018 20:28:04 +0200 Message-ID: <5B2A9CB4.7090702@free.fr> References: <87k1qu1yl5.fsf@mat.ucm.es> <5B29F072.4040805@free.fr> <87fu1h25a8.fsf@mat.ucm.es> Mime-Version: 1.0 Content-Type: text/plain; charset=utf-8; format=flowed Content-Transfer-Encoding: quoted-printable Return-path: Received: from eggs.gnu.org ([2001:4830:134:3::10]:56466) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1fVhpv-0001nN-Ic for emacs-orgmode@gnu.org; Wed, 20 Jun 2018 14:28:08 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1fVhpu-00077P-Nf for emacs-orgmode@gnu.org; Wed, 20 Jun 2018 14:28:07 -0400 Received: from smtp1-g21.free.fr ([2a01:e0c:1:1599::10]:49856) by eggs.gnu.org with esmtps (TLS1.0:DHE_RSA_AES_256_CBC_SHA1:32) (Exim 4.71) (envelope-from ) id 1fVhpu-00077H-H5 for emacs-orgmode@gnu.org; Wed, 20 Jun 2018 14:28:06 -0400 Received: from [IPv6:2a01:e35:2e21:def0:61ac:ee16:ceba:ad6c] (unknown [IPv6:2a01:e35:2e21:def0:61ac:ee16:ceba:ad6c]) by smtp1-g21.free.fr (Postfix) with ESMTP id EA5BCB00539 for ; Wed, 20 Jun 2018 20:28:04 +0200 (CEST) In-Reply-To: <87fu1h25a8.fsf@mat.ucm.es> List-Id: "General discussions about Org-mode." List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: emacs-orgmode-bounces+geo-emacs-orgmode=m.gmane.org@gnu.org Sender: "Emacs-orgmode" To: emacs-orgmode@gnu.org Le 20/06/2018 11:09, Uwe Brauer a =C3=A9crit : > > Le 19/06/2018 19:21, Uwe Brauer a =C3=A9crit : > > > You may want to take a look at the orgtbl-aggregate package avail= able on > > Melpa. > > > > Thanks very much. I have already installed that package but the example > presented in the documentation were too sophisticated for my purpose. M= ay > I suggest to include this example in the documentation, because your > package is a real time saver!! > I included such an example (and added your name to the contributors list)= . > I take the opportunity to ask whether your package can also easily > deal with the following problem (which is very important to me and > drives my crazy) Not easily. orgaggregate groups rows using equality, whereas you need to=20 group rows based on intervals (between 5 and 6.9 for example). But you can prepare the data table with a new, computed column, telling=20 in which interval each value falls: #+TBLNAME: raw-data | Test | Interval | |------+----------| | 0 | SS | | 1 | SS | | 2 | SS | | 3 | SS | | 4 | SS | | 5 | AP | | 6 | AP | | 7 | NT | | 8 | NT | | 9 | SB | | | NP | | | NP | | | NP | #+TBLFM: $2=3D "nan"=3D"$1" ? string("NP") : 0<=3D$1 && $1<=3D4.9 ? strin= g("SS")=20 : 5<=3D$1 && $1<=3D6.9 ? string("AP") : 7<=3D$1 && $1<=3D8.9 ? string("NT= ") :=20 9<=3D$1 && $1<=3D10 ? string("SB") : string("OTHER");E And then orgaggregate can handle it: #+BEGIN: aggregate :table "raw-data" :cols "Interval count()" | Interval | count() | |----------+---------| | SS | 5 | | AP | 2 | | NT | 2 | | SB | 1 | | NP | 3 | #+END: > > #+TBLFM: $4=3D'(length (org-lookup-all '($2 $3) '(remote(raw-data,@2$1.= .@>$1)) nil 'in-interval));N > > > However that function can not deal with empty strings (I could replace > the empty string by some string but then the function does not > distinguish between the string and 0). So I want that the entry NP > represents the counts of the empty strings: there are three in that col= umn. > > So can your package deal with this situation? > > Thanks again > > Uwe Brauer > I don't have a solution out of my hat. But I guess the problem you face=20 may originate from the remote() function. It filters out empty values.=20 However you can change this behavior using the ;E modifier. | [0, 1, 2, 3, 4, 5, 6, 7, 8, 9] | #+TBLFM: $1=3Dremote(raw-data,@2$1..@>$1) | [0, 1, 2, 3, 4, 5, 6, 7, 8, 9, nan, nan, nan] | #+TBLFM: $1=3Dremote(raw-data,@2$1..@>$1);E Regards Thierry