emacs-orgmode@gnu.org archives
 help / color / mirror / code / Atom feed
From: Eric S Fraga <e.fraga@ucl.ac.uk>
To: Tim Visher <tim.visher@gmail.com>
Cc: Org Mode List <emacs-orgmode@gnu.org>
Subject: Re: how to document/comment a complex org table formula
Date: Mon, 05 Jul 2021 16:39:37 +0100	[thread overview]
Message-ID: <87zgv093d2.fsf@ucl.ac.uk> (raw)
In-Reply-To: <CAHa53uwcWesXHjpECqyqD9wLsX+2SpN3C3hNL7JtupR-zvwBTg@mail.gmail.com> (Tim Visher's message of "Mon, 5 Jul 2021 10:55:10 -0400")

[-- Attachment #1: Type: text/plain, Size: 567 bytes --]

On Monday,  5 Jul 2021 at 10:55, Tim Visher wrote:
> I had never heard of using an org table as input into a source block.
> That's really interesting.

Attached, for illustration, is a simple example, extracted from a paper
I'm currently writing.  The "input" to the awk script is the table at
the top of the document.  The output, two columns of numbers, get
converted to an org table, at the bottom of the document, automatically.

-- 
: Eric S Fraga via Emacs 28.0.50, Org release_9.4.6-577-gf76d4d
: Latest paper written in org: https://arxiv.org/abs/2106.05096

[-- Warning: decoded text below may be mangled, UTF-8 assumed --]
[-- Attachment #2: example.org --]
[-- Type: text/x-org, Size: 1082 bytes --]


#+name: values
|-----------------------|
|  0.006780639787578286 |
|  0.006780639787578433 |
|  0.008195683980621288 |
|  0.006780639787578433 |
|  0.006780639787578286 |
|  0.006780639787578286 |
|  0.008195683980621288 |
|  0.006780639787578433 |
|  0.006780639787578286 |
| 0.0071466305079598775 |
|   0.01154503021335327 |
|  0.006780639787578433 |
|  0.010129986020310415 |
|   0.00819568398062114 |
|  0.006780639787578433 |
| 0.0071466305079598775 |
| 0.0071466305079598775 |
|-----------------------|

The table of values above include cases where rounding errors lead to slightly different results for what are essentially the same result.  The following awk script looks at only the significant digits to identify similar results:

#+name: frequency
#+begin_src awk :stdin values
  {
      if ($1 != "hline") {
          s = substr($1,2,9)
          n[s] += 1;
      }
  }
  END {
      for (val in n) {
          printf "%7.5f %d\n", val, n[val]
      }
  }
#+end_src

#+results: frequency
|  0.0082 | 3 |
| 0.00678 | 9 |
| 0.01013 | 1 |
| 0.00715 | 3 |
| 0.01154 | 1 |

  parent reply	other threads:[~2021-07-05 15:40 UTC|newest]

Thread overview: 14+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2021-07-04 19:14 how to document/comment a complex org table formula Uwe Brauer
2021-07-05 14:13 ` Eric S Fraga
2021-07-05 14:45   ` Uwe Brauer
2021-07-05 14:55   ` Tim Visher
2021-07-05 15:20     ` Jude DaShiell
2021-07-05 17:10       ` Uwe Brauer
2021-07-05 17:24         ` Jude DaShiell
2021-07-05 15:39     ` Eric S Fraga [this message]
2021-07-05 17:08     ` Uwe Brauer
2021-07-05 17:12 ` Karl Voit
2021-07-05 19:35   ` Uwe Brauer
  -- strict thread matches above, loose matches on Subject: below --
2021-07-05  5:31 CHARPENTIER Emmanuel via General discussions about Org-mode.
2021-07-05  6:29 ` Uwe Brauer
2021-07-08 20:19   ` Nick Dokos

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=87zgv093d2.fsf@ucl.ac.uk \
    --to=e.fraga@ucl.ac.uk \
    --cc=emacs-orgmode@gnu.org \
    --cc=tim.visher@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).