From mboxrd@z Thu Jan 1 00:00:00 1970 From: Uwe Brauer Subject: aggregate: percent, table headers, float format Date: Thu, 28 Jun 2018 14:53:24 +0200 Message-ID: <874lhn9inv.fsf@mat.ucm.es> Mime-Version: 1.0 Content-Type: text/plain Return-path: Received: from eggs.gnu.org ([2001:4830:134:3::10]:45529) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1fYWQm-0003rz-FQ for emacs-orgmode@gnu.org; Thu, 28 Jun 2018 08:53:50 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1fYWQg-0003KP-8Z for emacs-orgmode@gnu.org; Thu, 28 Jun 2018 08:53:48 -0400 Received: from [195.159.176.226] (port=44292 helo=blaine.gmane.org) by eggs.gnu.org with esmtps (TLS1.0:RSA_AES_128_CBC_SHA1:16) (Exim 4.71) (envelope-from ) id 1fYWQg-0003I8-09 for emacs-orgmode@gnu.org; Thu, 28 Jun 2018 08:53:42 -0400 Received: from list by blaine.gmane.org with local (Exim 4.84_2) (envelope-from ) id 1fYWOP-0002aB-22 for emacs-orgmode@gnu.org; Thu, 28 Jun 2018 14:51:21 +0200 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 Hi Org-aggregate is great and very helpful. However I have some problems/questions which I think a maybe interesting for the list. Take the following code #+begin_src emacs-lisp (setq org-calc-default-modes '(calc-internal-prec 12 calc-float-format (fix 3) ;;; the default here was (float 8) calc-angle-mode deg calc-prefer-frac nil calc-symbolic-mode nil calc-date-format (YYYY "-" MM "-" DD " " Www (" " hh ":" mm)) calc-display-working-message t)) #+end_src Which sets the float format to (fix 3) is taken into account by the org-table but ignored by org aggregate as the example below shows. #+TBLNAME: raw-data | Number | CalJunio | |--------+----------| | 1 | AP | | 2 | NT | | 3 | SS | | 4 | SS | | 5 | SS | | 6 | AP | | 7 | SS | | 8 | NP | | 9 | AP | | 10 | NP | | 11 | NP | | 12 | AP | | 13 | NP | | 14 | AP | | 15 | NP | | 16 | AP | | 17 | SS | | 18 | NP | | 19 | AP | #+TBLFM: $1=@#-1 I want that org aggregate counts the entries in the second column of the tale raw-data, which it does (thanks to Thierry), but I also would like to have, automatically, to calculate its percentage. And that it seems I can only do manually as the below example shows. #+BEGIN: aggregate :table "raw-data" :cols "CalJunio count() (count()/19)*100" | CalJunio | count() | (count()/19)*100 | |----------+---------+------------------| | AP | 7 | 36.8421052632 | | NT | 1 | 5.26315789474 | | SS | 5 | 26.3157894737 | | NP | 6 | 31.5789473684 | #+END: Is there a more elegant solution and how can I change the float format? By the way is there a way to customize the header of the above table, something like #+BEGIN: aggregate :table "raw-data" :cols "CalJunio count() (count()/19)*100" | CalJunio | count | percent | |----------+-------+---------------| | AP | 7 | 36.8421052632 | | NT | 1 | 5.26315789474 | | SS | 5 | 26.3157894737 | | NP | 6 | 31.5789473684 | #+END: thanks Uwe Brauer