emacs-orgmode@gnu.org archives
 help / color / mirror / code / Atom feed
From: stardiviner <numbchild@gmail.com>
To: Jeremie Juste <jeremiejuste@gmail.com>
Cc: emacs-orgmode@gnu.org
Subject: Re: org-babel strange html print in R
Date: Tue, 11 Feb 2020 13:16:26 +0800	[thread overview]
Message-ID: <87blq5u2j9.fsf@gmail.com> (raw)
In-Reply-To: <875zgjh8wn.fsf@gmail.com>


You should try ~:results value html~. Here is what I got correctly:

#+begin_src R :results value html
library(xtable)
x <- rnorm(100)
y <- x + rnorm(100)
print(xtable(summary(lm(y ~ x))),type="html")
#+end_src

#+RESULTS[<2020-02-11 13:14:59> 91ff0df2529284897e3585e3ec2e640290ee8308]:
#+begin_export html
<!-- html table generated in R 3.6.2 by xtable 1.8-3 package -->
<!-- Tue Feb 11 13:14:58 2020 -->
<table border=1>
<tr> <th>  </th> <th> Estimate </th> <th> Std. Error </th> <th> t value </th> <th> Pr(&gt;|t|) </th>  </tr>
  <tr> <td align="right"> (Intercept) </td> <td align="right"> -0.0064 </td> <td align="right"> 0.1069 </td> <td align="right"> -0.06 </td> <td align="right"> 0.9520 </td> </tr>
  <tr> <td align="right"> x </td> <td align="right"> 1.1066 </td> <td align="right"> 0.1022 </td> <td align="right"> 10.83 </td> <td align="right"> 0.0000 </td> </tr>
   </table>
#+end_export

Jeremie Juste <jeremiejuste@gmail.com> writes:

> Hello,
>
> I've found that some strange results when outputing html from R.
> Do you have some insights on a potential solution?
>
> Best regards,
> Jeremie
>
> Org mode version 9.3.4 (9.3.4-elpa @ /home/djj/.emacs.d/elpa/org-20200206/)
>
> #+PROPERTY: header-args:R  :eval yes  :exports results :colnames yes :results output :output-dir images/    :cache yes  :session *R* 
>
> #+begin_src R :results output html
> library(xtable)
> x <- rnorm(100)
> y <- x + rnorm(100)
> print(xtable(summary(lm(y ~ x))),type="html")
> #+end_src
>
>
> #+RESULTS:
> #+begin_export html
>
> <!-- html table generated in R 3.6.1 by xtable 1.8-4 package -->
> <!-- Thu Feb  6 19:13:34 2020 -->
> <table border=1>
> <
> <
>  </
> <
> Estimate </
> <
> Std. Error </
> <
> t value </
> <
> Pr(&gt;|t|) </
>  </tr>
>   <
> <td align="right"
> (Intercept) </
> <td align="right"
> -0.0130 </
> <td align="right"
> 0.1023 </
> <td align="right"
> -0.13 </
> <td align="right"
> 0.8991 </
> </tr>
>   <
> <td align="right"
> x </
> <td align="right"
> 1.0011 </
> <td align="right"
> 0.0987 </
> <td align="right"
> 10.14 </
> <td align="right"
> 0.0000 </
> </tr>
>    </table>
> #+end_export
>
>
> ** Expected results
> #+begin_export html
> <table border=1>
> <tr> <th>  </th> <th> Estimate </th> <th> Std. Error </th> <th> t value </th> <th> Pr(&gt;|t|) </th>  </tr>
>   <tr> <td align="right"> (Intercept) </td> <td align="right"> -0.0130 </td> <td align="right"> 0.1023 </td> <td align="right"> -0.13 </td> <td align="right"> 0.8991 </td> </tr>
>   <tr> <td align="right"> x </td> <td align="right"> 1.0011 </td> <td align="right"> 0.0987 </td> <td align="right"> 10.14 </td> <td align="right"> 0.0000 </td> </tr>
>    </table>
> #+end_export


-- 
[ stardiviner ]
       I try to make every word tell the meaning what I want to express.

       Blog: https://stardiviner.github.io/
       IRC(freenode): stardiviner, Matrix: stardiviner
       GPG: F09F650D7D674819892591401B5DF1C95AE89AC3
      

  parent reply	other threads:[~2020-02-11  5:16 UTC|newest]

Thread overview: 13+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2020-02-06 18:23 org-babel strange html print in R Jeremie Juste
2020-02-07 12:53 ` Dominique Dumont
2020-02-07 13:38   ` Bastien
2020-02-07 15:23     ` Dominique Dumont
2020-02-07 14:51   ` Jack Kamm
2020-02-07 23:54     ` Jeremie Juste
2020-02-08  1:30       ` Jack Kamm
2020-02-08  8:42         ` Jeremie Juste
2020-02-11  5:16 ` stardiviner [this message]
2020-02-11 15:40   ` Jack Kamm
2020-02-11 17:30     ` Jeremie Juste
2020-02-11 23:25       ` Jack Kamm
2020-02-12  7:05       ` stardiviner

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=87blq5u2j9.fsf@gmail.com \
    --to=numbchild@gmail.com \
    --cc=emacs-orgmode@gnu.org \
    --cc=jeremiejuste@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).