emacs-orgmode@gnu.org archives
 help / color / mirror / code / Atom feed
From: Brian Shine <brianshine@mac.com>
To: "Liste-emacs-orgmode@gnu.org" <emacs-orgmode@gnu.org>
Cc: Brian Shine <brianshine@mac.com>
Subject: org-mode R using xtable produces strange output
Date: Mon, 19 Mar 2018 23:44:21 +0000	[thread overview]
Message-ID: <27130615-8997-4101-9888-35829EE3D968@mac.com> (raw)

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

I am using xtable to produce summary tables of linear models, specifying the output as latex.  If I just run the code in R, I get the correct output.  However, the latex output in the org document contains a lot of “|”s.  I think this is because the header of the table contains some code to make “p > |t|”, where the vertical lines are to indicate “absolute value of t”.  My guess is that when the output is written to the results section, org interprets the “|” signs as an org-table and tries to be helpful by adding more of them to make up the correct number of columns. If I switch off the latex output, and write the xtable to a small .tex file, using xtable.print and then include the file after the code block, the table appears correctly.
I’m using emacs 25.2.

Here’s an example:


Best wishes,
Brian



[-- Attachment #2: xtableeg.org --]
[-- Type: application/octet-stream, Size: 1409 bytes --]

#+BEGIN_SRC R :session :exports results :results latex

  library(xtable)

  examp <- data.frame(x = 1:10, y = 10:1)

  print.xtable(xtable(summary(glm(y ~ x, data = examp))))

#+END_SRC

#+RESULTS:
#+BEGIN_EXPORT latex
| % latex table generated in R 3.4.4 by xtable 1.8-2 package        |     |       |
| % Mon Mar 19 23:41:04 2018                                        |     |       |
| \begin{table}[ht]                                                 |     |       |
| \centering                                                        |     |       |
| \begin{tabular}{rrrrr}                                            |     |       |
| \hline                                                            |     |       |
| & Estimate & Std. Error & t value & Pr($>$$                       | $t$ | $) \\ |
| \hline                                                            |     |       |
| (Intercept) & 11.0000 & 0.0000 & 10932581685367508.00 & 0.0000 \\ |     |       |
| x & -1.0000 & 0.0000 & -6166807764706701.00 & 0.0000 \\           |     |       |
| \hline                                                            |     |       |
| \end{tabular}                                                     |     |       |
| \end{table}                                                       |     |       |
|                                                                   |     |       |
#+END_EXPORT

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




             reply	other threads:[~2018-03-19 23:44 UTC|newest]

Thread overview: 3+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2018-03-19 23:44 Brian Shine [this message]
2018-03-20 16:47 ` org-mode R using xtable produces strange output Berry, Charles
2018-03-20 22:40   ` Brian Shine

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=27130615-8997-4101-9888-35829EE3D968@mac.com \
    --to=brianshine@mac.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).