emacs-orgmode@gnu.org archives
 help / color / mirror / code / Atom feed
From: Austin Frank <austin.frank@gmail.com>
To: emacs-orgmode@gnu.org
Subject: [babel]  apply #+TABLEFM lines during export?
Date: Sat, 10 Jul 2010 10:13:46 -0400	[thread overview]
Message-ID: <m0bpafpgpx.fsf@gmail.com> (raw)


[-- Attachment #1.1: Type: text/plain, Size: 2918 bytes --]

Hi all--

I have a (hopefully quick question) about formatting tabular output from
ob-R.  Consider the following block:

--8<---------------cut here---------------start------------->8---
#+source:  anova-example
#+BEGIN_SRC R :cache yes :exports results :colnames yes :results value
library(ez)
library(lme4)

eza <- ezANOVA(dv = .(Reaction),
               sid = .(Subject),
               within = .(Days),
               data = sleepstudy)

print(eza$ANOVA)
#+END_SRC
--8<---------------cut here---------------end--------------->8---

This produces the following output:
--8<---------------cut here---------------start------------->8---
#+results[7e7015e41d95ed8986fb9a211a8b5c6e121ae99d]: anova-example
| Effect | DFn | DFd |             SSn |              SSd |                F |                    p | p<.05 |              pes |
|--------+-----+-----+-----------------+------------------+------------------+----------------------+-------+------------------|
| Days   |   9 | 153 | 166235.12250176 | 151101.038615303 | 18.7026979326383 | 8.99534541600196e-21 | *     | 0.52384550792003 |
--8<---------------cut here---------------end--------------->8---

That's more precision than I want in export, so I add a formula line to
the results, hoping to change the formatting of the floats.  After
hitting C-u C-u C-c C-c in the table, I get the following:

--8<---------------cut here---------------start------------->8---
#+results[7e7015e41d95ed8986fb9a211a8b5c6e121ae99d]: anova-example
| Effect | DFn | DFd |         SSn |         SSd |       F |      p | p<.05 |    pes |
|--------+-----+-----+-------------+-------------+---------+--------+-------+--------|
| Days   |   9 | 153 | 166235.1200 | 151101.0400 | 18.7027 | 0.0000 | *     | 0.5238 |
#+TBLFM: $4=$4;%.4f::$5=$5;%.4f::$6=$6;%.4f::$7=$7;%.4f::$9=$9;%.4f
--8<---------------cut here---------------end--------------->8---

That's much better!  But, if I export this section to LaTeX, the formula
line is not applied and I end up with the full precision in my table.

--8<---------------cut here---------------start------------->8---
\begin{center}
\begin{tabular}{lrrrrrrlr}
 Effect  &  DFn  &  DFd  &              SSn  &               SSd  &                 F  &                     p  &  p<.05  &               pes  \\
\hline
 Days    &    9  &  153  &  166235.12250176  &  151101.038615303  &  18.7026979326383  &  8.99534541600196e-21  &  *      &  0.52384550792003  \\
\end{tabular}
\end{center}
--8<---------------cut here---------------end--------------->8---

Is there a way to make sure that the table formula is applied to the
results block during export?  Alternatively, is there another way to
reduce the precision of the numbers produced during export?

Thanks for any help!
/au

-- 
Austin Frank
http://aufrank.net
GPG Public Key (D7398C2F): http://aufrank.net/personal.asc

[-- Attachment #1.2: Type: application/pgp-signature, Size: 194 bytes --]

[-- Attachment #2: Type: text/plain, Size: 201 bytes --]

_______________________________________________
Emacs-orgmode mailing list
Please use `Reply All' to send replies to the list.
Emacs-orgmode@gnu.org
http://lists.gnu.org/mailman/listinfo/emacs-orgmode

             reply	other threads:[~2010-07-10 14:14 UTC|newest]

Thread overview: 5+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2010-07-10 14:13 Austin Frank [this message]
2010-07-11 22:26 ` [babel] apply #+TABLEFM lines during export? Eric Schulte
2010-07-13  3:59   ` Austin Frank
2010-07-13  5:06     ` Eric Schulte
2010-07-13 22:56       ` Austin Frank

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=m0bpafpgpx.fsf@gmail.com \
    --to=austin.frank@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).