emacs-orgmode
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [O] searching for csv utilities


From: Thierry Banel
Subject: Re: [O] searching for csv utilities
Date: Thu, 04 Jun 2015 23:24:54 +0200
User-agent: Mozilla/5.0 (X11; Linux x86_64; rv:31.0) Gecko/20100101 Thunderbird/31.0

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.
>
>  --
>
>
>




reply via email to

[Prev in Thread] Current Thread [Next in Thread]