I am using the 'compile pdf' button in a .Rnw file in Rstudio, including the following:

<<longterm1, results=tex, echo=FALSE>>=
print(xtable(longterm), include.rownames=FALSE, floating=FALSE)

But I receive a pop-up message,

'it seems you are using sweave-specific syntax .... you may need sweave2knitr ... to convert it to knitr'

pdflatex is installed and on my path, so I do not understand what I am doing wrong (I am a latex beginner though). How can I get this to work?

  • Whilst not answering the question, to work around the problem I am now creating a file with R code: print(table_longterm, type='latex', include.rownames=FALSE, file="table_longterm.tex") and then using \input{table_longterm.tex} Nov 21, 2014 at 7:19
  • If RStudio's global options are set up to use Sweave when you intend to use KnitR, you may get error messages and \SweaveOpts{concordance=TRUE} inserted into your document, which will then interfere with your ability to use KnitR even after you've changed RStudio's options to use KnitR. If you see what I mean.
    – PatrickT
    Apr 21, 2018 at 16:30

1 Answer 1


Use instead results='asis':

asis: output as-is, i.e., write raw results from R into the output document.

If you switch from Sweave to knitr, you probably need to read this page: http://yihui.name/knitr/demo/sweave/

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .