[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: [O] Determine min/max values in a table
From: |
Thierry Banel |
Subject: |
Re: [O] Determine min/max values in a table |
Date: |
Wed, 02 Aug 2017 23:22:56 +0200 |
User-agent: |
Mozilla/5.0 (X11; Linux x86_64; rv:31.0) Gecko/20100101 Thunderbird/31.0 |
Le 02/08/2017 14:07, Karl Voit a écrit :
> Hi!
>
> How can I determine minimum and/or maximum value of a table?
>
> Here is my example:
>
> #+NAME: myvalues
> | Values |
> |--------|
> | 4 |
> | 2 |
> | 3 |
> | 7 |
> | 5 |
> | 6 |
>
> | Min | Max | Average | First | Last |
> |--------+--------+---------+-------+------|
> | #ERROR | #ERROR | 4.5 | 4 | 6 |
> #+TBLFM: @2$1='(min (remote(myvalues,@2$1..@>$1)))::@2$2='(max
> (remote(myvalues,@2$1..@>$1)))::@2$3=vmean(remote(myvalues,@2$1..@>$1))::@2$4=remote(myvalues,@2$1)::@2$5=remote(myvalues,@>$1)
>
> My goal is to get min==2 in the first column and max==7 in the
> second.
>
Alternatively you have the orgtbl-aggregate package available on Melpa.
#+BEGIN: aggregate :table "myvalues" :cols "min(Values) max(Values)
mean(Values)"
| min(Values) | max(Values) | mean(Values) |
|-------------+-------------+--------------|
| 2 | 7 | 4.5 |
#+END: