From mboxrd@z Thu Jan 1 00:00:00 1970 From: Benjamin Beckwith Subject: Field coordinates and moving averages Date: Tue, 15 Nov 2011 10:21:40 -0500 Message-ID: <878vnhpfw5.fsf@bnbeckwith.com> Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii Return-path: Received: from eggs.gnu.org ([140.186.70.92]:37536) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1RQL2e-00023r-5r for emacs-orgmode@gnu.org; Tue, 15 Nov 2011 10:35:21 -0500 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1RQL2Z-000453-FP for emacs-orgmode@gnu.org; Tue, 15 Nov 2011 10:35:20 -0500 Received: from lo.gmane.org ([80.91.229.12]:57901) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1RQL2Z-00044q-3E for emacs-orgmode@gnu.org; Tue, 15 Nov 2011 10:35:15 -0500 Received: from list by lo.gmane.org with local (Exim 4.69) (envelope-from ) id 1RQL2X-0006JF-G9 for emacs-orgmode@gnu.org; Tue, 15 Nov 2011 16:35:13 +0100 Received: from pool-71-184-192-248.bstnma.fios.verizon.net ([71.184.192.248]) by main.gmane.org with esmtp (Gmexim 0.1 (Debian)) id 1AlnuQ-0007hv-00 for ; Tue, 15 Nov 2011 16:35:13 +0100 Received: from bnbeckwith by pool-71-184-192-248.bstnma.fios.verizon.net with local (Gmexim 0.1 (Debian)) id 1AlnuQ-0007hv-00 for ; Tue, 15 Nov 2011 16:35:13 +0100 List-Id: "General discussions about Org-mode." List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: emacs-orgmode-bounces+geo-emacs-orgmode=m.gmane.org@gnu.org Sender: emacs-orgmode-bounces+geo-emacs-orgmode=m.gmane.org@gnu.org To: emacs-orgmode@gnu.org 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