[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
## [O] No results when combining :session *R* with print.xtable

**From**: |
Stephan Lindner |

**Subject**: |
[O] No results when combining :session *R* with print.xtable |

**Date**: |
Thu, 10 Mar 2016 19:11:47 +0000 |

Hi,
I encounter the following problem (org version 8.3.2):
When I have the following R source code block in my org file:
#+BEGIN_SRC R :exports results :results replace output latex :eval export
library(xtable)
print(xtable(matrix(c(1,2,3), nrow=1)),
only.contents=TRUE, include.rownames=FALSE, include.colnames=FALSE,
comment=FALSE, hline.after=NULL)
#+END_SRC
and I evaluate it, I get the expected result:
#+RESULTS:
#+BEGIN_LaTeX
1.00 & 2.00 & 3.00 \\
#+END_LaTeX
However, when I also include the =:session *R*= in my header, I get this:
#+BEGIN_SRC R :session *R* :exports results :results replace output latex :eval
export
library(xtable)
print(xtable(matrix(c(1,2,3), nrow=1)),
only.contents=TRUE, include.rownames=FALSE, include.colnames=FALSE,
comment=FALSE, hline.after=NULL)
#+END_SRC
#+RESULTS:
#+BEGIN_LaTeX
#+END_LaTeX
I.e., no result. However, when evaluating the code in R it works (i.e., R
prints out =1.00 & 2.00 & 3.00 \\=).
I need to have =:session *R*= in the header because I want to print results of
previous calculations in R. I would like
to not have =\hlines= in my LaTeX output (I integrate the result into a LaTeX
table).
This problem does not occur when I set =hline.after= to a non-NULL value, e.g.:
#+BEGIN_SRC R :session *R* :exports results :results replace output latex :eval
export
library(xtable)
print(xtable(matrix(c(1,2,3), nrow=1)),
only.contents=TRUE, include.rownames=FALSE, include.colnames=FALSE,
comment=FALSE, hline.after=1)
#+END_SRC
#+RESULTS:
#+BEGIN_LaTeX
1.00 & 2.00 & 3.00 \\
\hline
#+END_LaTeX
Thanks!
Stephan
--
Stephan Lindner, Ph.D.
Oregon Health and Science University

**[O] No results when combining :session *R* with print.xtable**,
*Stephan Lindner* **<=**