emacs-orgmode@gnu.org archives
 help / color / mirror / code / Atom feed
From: "Berry, Charles" via "General discussions about Org-mode." <emacs-orgmode@gnu.org>
To: John Hendy <jw.hendy@gmail.com>
Cc: emacs-orgmode <emacs-orgmode@gnu.org>
Subject: Re: Number format for table results outut from R data.frame/tibble
Date: Sat, 21 Aug 2021 17:39:00 +0000	[thread overview]
Message-ID: <CCAC7632-230E-4614-AD14-53CE590C168A@health.ucsd.edu> (raw)
In-Reply-To: <CA+M2ft_dqZz8x04Q1oJReKoUrAU=n7BY52Rg3OTSO3JAjR3M1A@mail.gmail.com>

> On Aug 21, 2021, at 9:58 AM, John Hendy <jw.hendy@gmail.com> wrote:
> Interesting, and thanks for taking a look. I don't think I specified
> sufficiently that I'm actually aiming for latex/pdf output and
> therefore want the org table. 


If you want a latex export, you should use one of the many R packages[1] that format R objects for latex output.

For example:

#+begin_src R :session foo :results output latex
tmp <- tibble(x=1:5, y=x/pi)

#+begin_export latex

% latex table generated in R 4.1.0 by xtable 1.8-4 package
% Sat Aug 21 10:23:18 2021
 & x & y \\ 
1 &   1 & 0.32 \\ 
  2 &   2 & 0.64 \\ 
  3 &   3 & 0.95 \\ 
  4 &   4 & 1.27 \\ 
  5 &   5 & 1.59 \\ 

The xtable() and its print method have loads of options for formatting, setting environments and labels, and adding captions.

If you insist on doing this in org without the assistance of an R package, you will need to use a `:post' header argument.  If you have solid elisp skills, this is a viable option.


[1] One list of such is at: https://stackoverflow.com/questions/5465314/tools-for-making-latex-tables-in-r

  reply	other threads:[~2021-08-21 17:41 UTC|newest]

Thread overview: 5+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2021-08-06 15:38 John Hendy
2021-08-06 19:30 ` Berry, Charles via General discussions about Org-mode.
2021-08-21 16:58   ` John Hendy
2021-08-21 17:39     ` Berry, Charles via General discussions about Org-mode. [this message]
2021-08-21 19:55       ` Jeremie Juste

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:

  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=CCAC7632-230E-4614-AD14-53CE590C168A@health.ucsd.edu \
    --to=emacs-orgmode@gnu.org \
    --cc=ccberry@health.ucsd.edu \
    --cc=jw.hendy@gmail.com \
    --subject='Re: Number format for table results outut from R data.frame/tibble' \


* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link

Code repositories for project(s) associated with this inbox:


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