I got the below function from Prof's website: http://diskworld.wharton.upenn.edu/~foster/teaching/471/sweave-intro.pdf
The said function is meant for converting sweave (.Rnw) into PDF.
But when i run it on my machine, I get this error:
Error in match.arg(options$results, c("verbatim", "tex", "hide")) :
'arg' should be one of "verbatim", "tex", "hide"
Function:
Sweatex <- function(filename,extension='Rnw',
command='pdflatex',silent=FALSE,preview=FALSE) {
if (command=='latex') command='simpdftex latex --maxpfb'
extension<-paste('.',extension,sep='')
path=options('latexcmd')[[1]]
path=substr(path,start=1,stop=nchar(path)-5)
Sweave(paste(filename,extension,sep=''))
system(paste(path,command,' ',filename,sep=''),intern=silent)
if (preview)
{
system(paste(options('pdfviewer')[[1]],' ',filename,'.pdf',sep=''))
}
}
Could anyone throw some lights? Thanks, in advance.
Regards, Tharma
Sweave("yourfile.Rnw")in your R console and then runningpdflatex yourfilein the terminal. There is this discussion in SO about efficient Sweave workflow too. – hpesoj626 Jul 24 '13 at 14:09