emacs-orgmode@gnu.org archives
 help / color / mirror / code / Atom feed
From: Benjamin Beckwith <bnbeckwith@gmail.com>
To: emacs-orgmode@gnu.org
Subject: Field coordinates and moving averages
Date: Tue, 15 Nov 2011 10:21:40 -0500	[thread overview]
Message-ID: <878vnhpfw5.fsf@bnbeckwith.com> (raw)


I'm trying to create a table of periodic data and calculate a moving
average in an adjacent column.  I was trying to use field coordinates,
but they do not work how I would like them to work.

Here is what I have for a 5-day moving average:

| Daily Data | Moving Average |
|------------+----------------|
|         10 |                |
|         11 |                |
|         12 |                |
|         13 |                |
|         14 |                |
|         14 |                |
|         16 |                |
#+TBLFM: $2=if(@# >=7, vmean(@-5$1..@0$1),string(""));

I expeced the if(@# >=7..) to protect the sub-clauses from executing
unless the predicate is true.  However, that is not the case.  When I
try to execute this formula, I receive the error: "Row descriptor -5
used in line ### leads outside table".

I can see how this is true if the ranges are checked for every entry.
Is there a better way for me to write this column forumla?  Is this a
limitation in the field coordinates?

Thanks,
Ben

             reply	other threads:[~2011-11-15 15:35 UTC|newest]

Thread overview: 3+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2011-11-15 15:21 Benjamin Beckwith [this message]
2011-11-15 15:52 ` Field coordinates and moving averages Nick Dokos
2011-11-15 19:16   ` Michael Brand

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=878vnhpfw5.fsf@bnbeckwith.com \
    --to=bnbeckwith@gmail.com \
    --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).