emacs-orgmode@gnu.org archives
 help / color / mirror / code / Atom feed
* Re: calculating column averages follow up
@ 2011-07-22  9:35 Jude DaShiell
  2011-07-22 10:55 ` Nick Dokos
  0 siblings, 1 reply; 4+ messages in thread
From: Jude DaShiell @ 2011-07-22  9:35 UTC (permalink / raw)
  To: emacs-orgmode

I removed a separator line above averages and removed a row with blank 
fields and ran the calculation on this table and it does have a defective 
formula but I don't know where the defect is now.

| Date Stamp             | Systalic | Diastalic | Pulse |   |   |   |   |   |   |   |
|------------------------+----------+-----------+-------+---+---+---+---+---+---+---|
| [2011-07-19 Tue 02:26] |      138 |        92 |    74 |   |   |   |   |   |   |   |
| [2011-07-21 Thu 03:50] |      128 |        79 |    76 |   |   |   |   |   |   |   |
| [2011-07-20 Wed 04:03] |      130 |        85 |    74 |   |   |   |   |   |   |   |
| [2011-07-22 Fri 02:33] |      121 |        80 |    79 |   |   |   |   |   |   |   |
| Averages               |   #ERROR |           |       |   |   |   |   |   |   |   |
|                        |          |         - |       |   |   |   |   |   |   |   |
|                        |          |           |       |   |   |   |   |   |   |   |
#+TBLFM: $2=vmean(@<..@>)

# Local Variables:
# kept-new-versions: 100
# version-control: t
# End:

-

^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: calculating column averages follow up
  2011-07-22  9:35 calculating column averages follow up Jude DaShiell
@ 2011-07-22 10:55 ` Nick Dokos
  2011-07-23  8:56   ` Jude DaShiell
  0 siblings, 1 reply; 4+ messages in thread
From: Nick Dokos @ 2011-07-22 10:55 UTC (permalink / raw)
  To: Jude DaShiell; +Cc: nicholas.dokos, emacs-orgmode

Jude DaShiell <jdashiel@shellworld.net> wrote:

> I removed a separator line above averages and removed a row with blank 
> fields and ran the calculation on this table and it does have a defective 
> formula but I don't know where the defect is now.
> 
> | Date Stamp             | Systalic | Diastalic | Pulse |   |   |   |   |   |   |   |
> |------------------------+----------+-----------+-------+---+---+---+---+---+---+---|
> | [2011-07-19 Tue 02:26] |      138 |        92 |    74 |   |   |   |   |   |   |   |
> | [2011-07-21 Thu 03:50] |      128 |        79 |    76 |   |   |   |   |   |   |   |
> | [2011-07-20 Wed 04:03] |      130 |        85 |    74 |   |   |   |   |   |   |   |
> | [2011-07-22 Fri 02:33] |      121 |        80 |    79 |   |   |   |   |   |   |   |
> | Averages               |   #ERROR |           |       |   |   |   |   |   |   |   |
> |                        |          |         - |       |   |   |   |   |   |   |   |
> |                        |          |           |       |   |   |   |   |   |   |   |
> #+TBLFM: $2=vmean(@<..@>)
> 

Two problems: 1) you want to set a single cell but the way the formula is written
makes it a column formula  and 2) the rows as written include the header line and go
all the way to the bottom - assuming you want the two rows after the "Averages" row,
you can say

#+TBLFM: @>>>$2=vmean(@<<..@>>>>)

That says "the third row from the bottom in column two is the mean of the rows in the
same column, ranging from second from the top to fourth from the bottom".

I thought I could use references relative to @> (e.g. @>-3) but apparently that's
not the case:

#+TBLFM: @>>>$2=vmean(@<<..@>-3)

does not work for me.

Nick

^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: calculating column averages follow up
  2011-07-22 10:55 ` Nick Dokos
@ 2011-07-23  8:56   ` Jude DaShiell
  2011-07-23  9:39     ` Achim Gratz
  0 siblings, 1 reply; 4+ messages in thread
From: Jude DaShiell @ 2011-07-23  8:56 UTC (permalink / raw)
  To: Nick Dokos; +Cc: emacs-orgmode

Thanks, here's what I have now and it almost works.  When I add a new 
line though the averages don't change until I delete the TBLFM: line and 
the line with the =vmean(@2..-1) formulas on it then key the formulas in 
again.  Then the averages do update to reflect new numbers.  That's not 
a difficulty though, I can easily handle that light work using a sed 
script.

| Date Stamp             | Systalic | Diastalic | Pulse |   |   |   |   |   |   |   |
|------------------------+----------+-----------+-------+---+---+---+---+---+---+---|
| [2011-07-19 Tue 02:26] |      138 |        92 |    74 |   |   |   |   |   |   |   |
| [2011-07-21 Thu 03:50] |      128 |        79 |    76 |   |   |   |   |   |   |   |
| [2011-07-20 Wed 04:03] |      130 |        85 |    74 |   |   |   |   |   |   |   |
| [2011-07-22 Fri 02:33] |      121 |        80 |    79 |   |   |   |   |   |   |   |
| [2011-07-23 Sat 02:52] |      118 |        75 |    68 |   |   |   |   |   |   |   |
|------------------------+----------+-----------+-------+---+---+---+---+---+---+---|
| Averages               |      127 |      82.2 |  74.2 |   |   |   |   |   |   |   |
|                        |          |           |       |   |   |   |   |   |   |   |
#+TBLFM: $2=vmean(@2..-1)::$3=vmean(@2..-1)::$4=vmean(@2..-1)
# Local Variables:
# kept-new-versions: 100
# version-control: t
# End:

-
On Fri, 22 Jul 2011, Nick Dokos wrote:

> Jude DaShiell <jdashiel@shellworld.net> wrote:
> 
> > I removed a separator line above averages and removed a row with blank 
> > fields and ran the calculation on this table and it does have a defective 
> > formula but I don't know where the defect is now.
> > 
> > | Date Stamp             | Systalic | Diastalic | Pulse |   |   |   |   |   |   |   |
> > |------------------------+----------+-----------+-------+---+---+---+---+---+---+---|
> > | [2011-07-19 Tue 02:26] |      138 |        92 |    74 |   |   |   |   |   |   |   |
> > | [2011-07-21 Thu 03:50] |      128 |        79 |    76 |   |   |   |   |   |   |   |
> > | [2011-07-20 Wed 04:03] |      130 |        85 |    74 |   |   |   |   |   |   |   |
> > | [2011-07-22 Fri 02:33] |      121 |        80 |    79 |   |   |   |   |   |   |   |
> > | Averages               |   #ERROR |           |       |   |   |   |   |   |   |   |
> > |                        |          |         - |       |   |   |   |   |   |   |   |
> > |                        |          |           |       |   |   |   |   |   |   |   |
> > #+TBLFM: $2=vmean(@<..@>)
> > 
> 
> Two problems: 1) you want to set a single cell but the way the formula is written
> makes it a column formula  and 2) the rows as written include the header line and go
> all the way to the bottom - assuming you want the two rows after the "Averages" row,
> you can say
> 
> #+TBLFM: @>>>$2=vmean(@<<..@>>>>)
> 
> That says "the third row from the bottom in column two is the mean of the rows in the
> same column, ranging from second from the top to fourth from the bottom".
> 
> I thought I could use references relative to @> (e.g. @>-3) but apparently that's
> not the case:
> 
> #+TBLFM: @>>>$2=vmean(@<<..@>-3)
> 
> does not work for me.
> 
> Nick
> 
> 

^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: calculating column averages follow up
  2011-07-23  8:56   ` Jude DaShiell
@ 2011-07-23  9:39     ` Achim Gratz
  0 siblings, 0 replies; 4+ messages in thread
From: Achim Gratz @ 2011-07-23  9:39 UTC (permalink / raw)
  To: emacs-orgmode

Jude DaShiell <jdashiel@shellworld.net> writes:
> Thanks, here's what I have now and it almost works.  When I add a new 
> line though the averages don't change until I delete the TBLFM: line and 
> the line with the =vmean(@2..-1) formulas on it then key the formulas in 
> again.  Then the averages do update to reflect new numbers.  That's not 
> a difficulty though, I can easily handle that light work using a sed 
> script.

Nah... I think you would want you table like that:

|   | Date Stamp             | Systolic | Diastolic | Pulse |
|---+------------------------+----------+-----------+-------|
|   | [2011-07-19 Tue 02:26] |      138 |        92 |   174 |
|   | [2011-07-21 Thu 03:50] |      128 |        79 |    76 |
|   | [2011-07-20 Wed 04:03] |      130 |        85 |    74 |
|   | [2011-07-22 Fri 02:33] |      121 |        80 |    79 |
|   | [2011-07-23 Sat 02:52] |      118 |        75 |    68 |
|---+------------------------+----------+-----------+-------|
| # | Average                |    127.0 |      82.2 |  94.2 |
|   |                        |          |           |       |
#+TBLFM: @>>$3..@>>$5=vmean(@I..II);%.1f

Then you can just add another line, tab into the averages line and
everything updates just the way you want.


Regards,
Achim.
-- 
+<[Q+ Matrix-12 WAVE#46+305 Neuron microQkb Andromeda XTk Blofeld]>+

SD adaptations for Waldorf Q V3.00R3 and Q+ V3.54R2:
http://Synth.Stromeko.net/Downloads.html#WaldorfSDada

^ permalink raw reply	[flat|nested] 4+ messages in thread

end of thread, other threads:[~2011-07-23  9:39 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2011-07-22  9:35 calculating column averages follow up Jude DaShiell
2011-07-22 10:55 ` Nick Dokos
2011-07-23  8:56   ` Jude DaShiell
2011-07-23  9:39     ` Achim Gratz

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