0

I can not compile a pdf file from .Rnw file if there is the argument results="asis" in my code chunk. R console wants me to se result as “verbatim”, “tex” or “hide”. However, I need to use "asis" because otherwise the table is displayed as text. Any ideas what could be the problem? Thanks Kamila

The code chunk:

<<table_symbionts, results="asis">>=
n <- 100
x <- rnorm(n)
y <- 2*x + rnorm(n)
out <- lm(y ~ x)
library(xtable)
tab <- xtable(summary(out)$coef, digits=c(0, 2, 2, 1, 2))
print(tab, type="html")
@

The output:

Writing to file Thesis.tex
Processing code chunks with options ...
Error in match.arg(options$results, c("verbatim", "tex", "hide")) : 
  'arg' should be one of “verbatim”, “tex”, “hide”
Calls: <Anonymous> -> SweaveParseOptions -> check -> match.arg
Execution halted
kamila
  • 122
  • 1
  • 2
  • 13
  • You're compiling a latex file to pdf, so shouldn't the `print` statement be `print(tab, type="latex")`? When I run your code in an R Sweave file with `type="latex"` it seems to work fine. – eipi10 Oct 15 '15 at 20:48
  • 2
    Just like http://stackoverflow.com/q/33048647/559676 again, I believe you are using Sweave instead of knitr. – Yihui Xie Oct 16 '15 at 04:12
  • 1
    I have changed options according to the question "r knitr chunk options for figure height / width are not working". (I haven`t found it by myself because it referred to figures and not tables). Then I had to remove the line: "\SweaveOpts{concordance=TRUE}" and it worked. Thanks for responses! – kamila Oct 18 '15 at 16:18

0 Answers0