[Tex/LaTex] RStudio problem with xtable “results=tex”… “object tex not found”

rsweavextable

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?

Best Answer

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/