0

Can we do statistic with remote table?

Say TBL2 row1 is min of TBL1 columns,TBL2 row2 is max of TBL1 columns. I write formula as below but it doesn't work!

#+NAME: TBL1
|  2 |  3 |
|  4 |  5 |
|  7 | 10 |
| 12 | 1  | 

#+NAME: TBL2
| #ERROR | #ERROR |
| #ERROR | #ERROR |
#+TBLFM: @1$1='(seq-min remote(TBL1,$1))::@1$2='(seq-min remote(TBL1,$2))::@2$1='(seq-max remote(TBL1,$1))::@2$2='(seq-max remote(TBL1,$2))

expected output is:

#+NAME: TBL2
|  2 |  1 |
| 12 | 10 |
  • Part of the problem is that the remote call returns the required bits and pieces of the remote table as strings. Enabling formula debugging might provide more information and allow you to convert what remote returns to the form that seq-min expects. – NickD Mar 24 '17 at 12:42
1
  1. Should not use '$1' to access column1 values, but use '@1$1..@1$>'.
  2. Should use calcFunc vector functions 'calcFunc-v**', vmin/vmax for this case.

```

#+NAME: TBL1
|  2 |  3 |
|  4 |  5 |
|  7 | 10 |
| 12 | 1  | 

#+NAME: TBL2
|  2 |  1 |
| 12 | 10 |
#+TBLFM: @1$1=vmin(remote(TBL1,@1$1..@>$1))::@1$2=vmin(remote(TBL1,@1$2..@>$2))::@2$1=vmax(remote(TBL1,@1$1..@>$1))::@2$2=vmax(remote(TBL1,@1$2..@>$2))

```

  • In 1. the range should be @1$1..@>$1 i.e. first row to last row in column 1. – NickD Mar 25 '17 at 2:39
  • In 2. the formula could be done in elisp: #+TBLFM: @1$1 = '(seq-min (mapcar #'string-to-number (list remote(TBL1, @1$1..@>$1)))) but the calc solution in the answer is certainly preferable. – NickD Mar 25 '17 at 2:47
0

In TBLFM row, you must use Emacs calc syntax to do calculations, not emacs lisp syntax. So the seq-min in your TBLFM will not work.

  • That's not true: you can use lisp syntax as shown in the OP's table. See Formula syntax in lisp. – NickD Mar 24 '17 at 12:36
  • Oh, sorry for my wrong answer. – cmal Mar 25 '17 at 3:35

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.