emacs-orgmode
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: org-babel strange html print in R


From: Jeremie Juste
Subject: Re: org-babel strange html print in R
Date: Sat, 08 Feb 2020 09:42:11 +0100
User-agent: Gnus/5.13 (Gnus v5.13) Emacs/26.2 (gnu/linux)

Hello Jack,

Thanks for taking the time to reply.

> I think a more reliable implementation would be to avoid
> `org-babel-comint-with-output', and take the approach used in the
> ":results value" case, which reads the output from a temp file instead
> of directly from the shell.
I understand better now. Thanks
>
> Actually, that's the approach I use in my ob-session-async package [0],
> which re-implements ob-R sessions to allow async evaluation. It doesn't
> suffer from the bug you are reporting. I'll plan to extract that
> implementation and submit it as a patch here.

Your solution works just fine. I came across ob-session-async a recently
and find it very interesting thanks again.

#+begin_src R :results output html :cache no :async session
  library(xtable)
  x <- rnorm(100)
  y <- x + rnorm(100)
  a <- summary(lm(y ~ x))
  print(xtable(a),type="html",comment=FALSE)
#+end_src

#+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.1249 </td> <td 
align="right"> 0.0961 </td> <td align="right"> 1.30 </td> <td align="right"> 
0.1969 </td> </tr>
  <tr> <td align="right"> x </td> <td align="right"> 0.9263 </td> <td 
align="right"> 0.0879 </td> <td align="right"> 10.53 </td> <td align="right"> 
0.0000 </td> </tr>
   </table>
#+end_export

Best regards,
Jeremie



reply via email to

[Prev in Thread] Current Thread [Next in Thread]