emacs-orgmode@gnu.org archives
 help / color / mirror / code / Atom feed
From: Thierry Banel <tbanelwebmin@free.fr>
To: emacs-orgmode@gnu.org
Subject: Re: searching for csv utilities
Date: Thu, 04 Jun 2015 23:24:54 +0200	[thread overview]
Message-ID: <5570C226.9090300@free.fr> (raw)
In-Reply-To: <alpine.NEB.2.11.1506020733250.26150@panix2.panix.com>

You may want to consider a slightly different approach. It may (or
maynot) be relevant depending on your context.

First, denormalize your table into a "fact table" (which is handy when
dealingwith cubes):

#+name: data
| date             | type  |   q |
|------------------+-------+-----|
| [2014-04-27 Sun] | Sys   | 125 |
| [2014-04-28 Mon] | Sys   | 102 |
| [2014-04-29 Tue] | Sys   | 115 |
| [2014-04-27 Sun] | Dia   |  88 |
| [2014-04-28 Mon] | Dia   |  88 |
| [2014-04-29 Tue] | Dia   |  88 |
| [2014-04-27 Sun] | Pul   |  78 |
| [2014-04-28 Mon] | Pul   |  86 |
| [2014-04-29 Tue] | Pul   |  85 |
| [2014-04-27 Sun] | Sugar |  92 |
| [2014-04-28 Mon] | Sugar |  92 |
| [2014-04-29 Tue] | Sugar |  95 |

Then using a package named "org-aggregate" (on Melpa) you can derivean
aggregated table:

#+name: aggr
#+BEGIN: aggregate :table data :cols "type vcount() vmean(q) vmax(q)
vsdev(q);f3"
| type  | vcount() | vmean(q) | vmax(q) | vsdev(q);f3 |
|-------+----------+----------+---------+-------------|
| Sys   |        3 |      114 |     125 |      11.533 |
| Dia   |        3 |       88 |      88 |           0 |
| Pul   |        3 |       83 |      86 |       4.359 |
| Sugar |        3 |       93 |      95 |       1.732 |
#+END:

If you want to rotate this table, apply a transposition on it(provided
by the same package):

#+BEGIN: transpose :table "aggr"
| type        |   |    Sys | Dia |   Pul | Sugar |
| vcount()    |   |      3 |   3 |     3 |     3 |
| vmean(q)    |   |    114 |  88 |    83 |    93 |
| vmax(q)     |   |    125 |  88 |    86 |    95 |
| vsdev(q);f3 |   | 11.533 |   0 | 4.359 | 1.732 |
#+END:

You can sort the "data" table on dates without changing theaggregation.

Thierry

Le 02/06/2015 13:44, Jude DaShiell a écrit :
> | Date             |               Sys | Dia | Pul | Sugar |
> |------------------+-------------------+-----+-----+-------|
> | [2014-04-27 Sun] |               125 |  88 |  78 |    92 |
> | [2014-04-28 Mon] |               102 |  88 |  86 |    92 |
> | Averages:        | =$2=vmean(@<..@>) |     |     |       |
> #+TBLFM: $2=$2=vmean(@<..@>)
>
> This is a cut down version of my full record set.  Sometimes when I
> key formulas in I get ?ERROR back for a result after keying in c-c+c-c
> once I've completed the formula and hit tab.  If I do c-u+c-c+c-c that
> sometimes generated ?ERROR.  Other times I key in a formula and the
> cursor gets locked and I have to hit c-g to exit #+TBLFM: mode; I
> don't know what's actually happening when that situation arises since
> other than suddenly finding the cursor locked I can neither tell what
> state I'm in or if a few more keystrokes are needed or if I've
> generated an error situation.
>
>  --
>
>
>

  parent reply	other threads:[~2015-06-04 21:25 UTC|newest]

Thread overview: 20+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2015-06-02 11:44 searching for csv utilities Jude DaShiell
2015-06-02 12:04 ` Jonathan Leech-Pepin
2015-06-03 15:46   ` Jude DaShiell
2015-06-03 16:07   ` Jude DaShiell
2015-06-03 16:38     ` Jonathan Leech-Pepin
2015-06-03 21:12       ` Jude DaShiell
2015-06-03 22:01         ` Nick Dokos
2015-06-03 17:21     ` Nick Dokos
2015-06-03 18:04       ` Nick Dokos
2015-06-03 20:05       ` Michael Brand
2015-06-03 20:52         ` Nick Dokos
2015-06-04  7:21         ` e.fraga
2015-06-04  9:15           ` Michael Brand
2015-06-04 15:22             ` Nick Dokos
2015-06-04 15:43               ` Nick Dokos
2015-06-04 15:45               ` Michael Brand
2015-06-04  1:21   ` Jude DaShiell
2015-06-04 21:24 ` Thierry Banel [this message]
2015-06-05  7:13   ` Eric S Fraga
  -- strict thread matches above, loose matches on Subject: below --
2015-06-19  0:58 Jude DaShiell

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

  List information: https://www.orgmode.org/

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=5570C226.9090300@free.fr \
    --to=tbanelwebmin@free.fr \
    --cc=emacs-orgmode@gnu.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
Code repositories for project(s) associated with this public inbox

	https://git.savannah.gnu.org/cgit/emacs/org-mode.git

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).