[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: org-babel strange html print in R
From: |
stardiviner |
Subject: |
Re: org-babel strange html print in R |
Date: |
Tue, 11 Feb 2020 13:16:26 +0800 |
User-agent: |
mu4e 1.3.8; emacs 27.0.50 |
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(>|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 <address@hidden> 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(>|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(>|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
Re: org-babel strange html print in R,
stardiviner <=