From mboxrd@z Thu Jan 1 00:00:00 1970 From: Thierry Banel Subject: Re: syntax for remote table/cell references Date: Mon, 30 Nov 2015 20:45:36 +0100 Message-ID: <565CA760.3050905@free.fr> References: Mime-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: quoted-printable Return-path: Received: from eggs.gnu.org ([2001:4830:134:3::10]:43135) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1a3UON-0008O7-V7 for emacs-orgmode@gnu.org; Mon, 30 Nov 2015 14:45:44 -0500 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1a3UOM-0005kt-Qh for emacs-orgmode@gnu.org; Mon, 30 Nov 2015 14:45:43 -0500 Received: from smtp3-g21.free.fr ([2a01:e0c:1:1599::12]:64429) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1a3UOM-0005k4-Kv for emacs-orgmode@gnu.org; Mon, 30 Nov 2015 14:45:42 -0500 Received: from [IPv6:2a01:e35:2e21:def0:2cbb:8546:be99:e7bb] (unknown [IPv6:2a01:e35:2e21:def0:2cbb:8546:be99:e7bb]) by smtp3-g21.free.fr (Postfix) with ESMTP id 874AAA624D for ; Mon, 30 Nov 2015 20:44:59 +0100 (CET) In-Reply-To: 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-bounces+geo-emacs-orgmode=m.gmane.org@gnu.org To: emacs-orgmode@gnu.org You may want to give the orgtbl-aggregate package a try. (Available on http://melpa.org, documentation here: https://github.com/tbanel/orgaggregate) It creates the following table: #+BEGIN: aggregate :table "grades" :cols "Precis count()" | Precis | count() | |---------+---------| | A- | 7 | | A | 7 | | B | 2 | | B+? A-? | 1 | | B+ | 4 | #+END: Read it as: - the "aggregate" function - uses the "grades" table, - groups rows with the same "Precis" value - and "counts()" rows in each group. There is a wizard to create it: - M-x org-insert-dblock:aggregate - C-c C-x i aggregate You may add an ASCII-art plot by hitting: C-c " a #+BEGIN: aggregate :table "grades" :cols "Precis count()" | Precis | count() | | |---------+---------+---------| | A- | 7 | WWWWWWW | | A | 7 | WWWWWWW | | B | 2 | WW | | B+? A-? | 1 | W | | B+ | 4 | WWWW | #+TBLFM: $3=3D'(orgtbl-ascii-draw $2 0 7 7) #+END: Have fun Thierry Le 30/11/2015 17:36, Matt Price a =C3=A9crit : > Hello everyone, > > I'm trying to simulate a simple "COUNT" spreadsheet function with the > following two tables: > > #+TBLNAME: grades > | Student | Precis | POV PAPER | > |-----------------------+---------+-----------| > | | A- | A- | > | | A | A-/B+ | > | | A- | A | > | | B | B+ | > | | A- | B+ | > | | A | A | > | | A | A- | > | | A- | B+ | > | | A- | A- | > | | A | A | > | | A | A | > | | B+? A-? | A- | > | | A- | B+ | > | | B | B+ | > | | B+ | A- | > | | A- | A- | > | | A | B+ | > | | B+ | B | > | | B+ | B+ | > | | B+ | B | > | | A | A- | > > > | Grade | Count in Precis | Percent | > |-------+--------+---------| > | A+ | #ERROR | | > | A | #ERROR | | > | A- | #ERROR | | > | B+ | #ERROR | | > | B | #ERROR | | > | B- | #ERROR | | > | C+ | #ERROR | | > | C | #ERROR | | > | C- | #ERROR | | > | F | #ERROR | | > #+TBLFM: $2=3D'(length (org-lookup-all $1 '(remote(grades,$2))));E > > Sorry for the ugly formatting.=20 > I want to just count the number of As, A-'s, etc, so I can see how > badly I've messed up my distribution, and how much regrading I need to > do. I don't understand the syntax for referencing cell ranges in > org-lookup-all, nor do I quite get how "remote" works (doesn't seem to > be a normal function?). Am trying to follow worg tutorials but not > having much luck.=20 > > Thanks, > Matt >