emacs-orgmode@gnu.org archives
 help / color / mirror / code / Atom feed
From: Nick Dokos <nicholas.dokos@hp.com>
To: Rodolfo Aramayo <raramayo@gmail.com>
Cc: emacs-orgmode@gnu.org
Subject: Re: Statistics in Org-Tables
Date: Wed, 20 Feb 2013 13:27:16 -0500	[thread overview]
Message-ID: <2964.1361384836@alphaville> (raw)
In-Reply-To: Message from Rodolfo Aramayo <raramayo@gmail.com> of "Wed, 20 Feb 2013 10:47:45 CST." <CAKHaNCoomg9q8weRGXgRtKqP4y+AhCPcV00izdv__OP5GiCufg@mail.gmail.com>

Rodolfo Aramayo <raramayo@gmail.com> wrote:

> Simple question: What is the best way to configure/find out how to
> calculate Median, Standard Deviation in an org-table?

There are calc functions to compute these things, but the layout of your
table will of course influence the formulas. Here's a simple example
that calculates the statistics for the second column - it uses the
@I..@II range reference notation to get the numbers between the first
and second separators and the @> (@>>, @>>>, etc.) notation to refer to
the last (last minus one, last minus two, etc.) row:

--8<---------------cut here---------------start------------->8---

* mean, median, stdev

|      i |         x |
|--------+-----------|
|      1 |         3 |
|      2 |         1 |
|      3 |         1 |
|      4 |         2 |
|      5 |         1 |
|      6 |         3 |
|      7 |         4 |
|      8 |         1 |
|      9 |         1 |
|--------+-----------|
|   mean | 1.8888889 |
| median |         1 |
|   sdev | 1.1666667 |
|    sum |        17 |
#+TBLFM: @>$2=vsum(@I..@II) :: @>>>>$2=vmean(@I..@II) :: @>>>$2=vmedian(@I..@II) :: @>>$2=vsdev(@I..@II)
--8<---------------cut here---------------end--------------->8---

More details about such references are in the Org manual:

(info "(org) References")

More details about the calc functions are in the Calc manual:

(info "(calc) Single-variable statistics")

Nick

      parent reply	other threads:[~2013-02-20 18:27 UTC|newest]

Thread overview: 4+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2013-02-20 16:47 Statistics in Org-Tables Rodolfo Aramayo
2013-02-20 18:04 ` JBash
2013-02-20 18:13   ` Rodolfo Aramayo
2013-02-20 18:27 ` Nick Dokos [this message]

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=2964.1361384836@alphaville \
    --to=nicholas.dokos@hp.com \
    --cc=emacs-orgmode@gnu.org \
    --cc=raramayo@gmail.com \
    /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).