2
votes

I want to use 'R' script to convert my Sweave file into PDF ultimately. I learnt that, Sweave(file="TEST.Rnw") is the function that can convert my .Rnw into .tex.

But I see a strange issue when I use that on my .Rnw file that has a code chunk like this:

    <<results='asis', comment=NA, echo=FALSE, warning=FALSE>>=
    ...
    @

This is the error, I am getting:

Error in match.arg(options$results, c("verbatim", "tex", "hide")) :
'arg' should be one of "verbatim", "tex", "hide"

Please note that Sweave() works when I change results='tex'. But that does not help me as I have some xtable content that needs to be coming in latex. The simple question, therefore, is, when the option results='asis' works on RStudio (Complile PDF), why it does not with Sweave function call? Am I missing something?

Any lights on this will be highly appreciated... Thanks, in advance.

Regards, Tharma

1
Package knitr uses "asis" while Sweave uses "tex".Roman Luštrik
Thank you. Yes, I just realized that using 'knitr::knit2pdf' does the magic!user2418594

1 Answers

-4
votes

Try to pass result=tex (without quotes).