[R] Rename output file in Swaeve and Tex

Yihui Xie xie at yihui.name
Fri Jun 15 17:11:48 CEST 2012


I do not think it is possible with the 'R CMD Sweave' interface, but
you can always use the 'R -e' approach, e.g. R -e 'Sweave("foo.Rnw");
file.rename("foo.tex", "foo-bar.tex"); tools::texi2dvi('foo-bar.tex')'
(not tested, but idea is there)

To make this more natural, you can try the knitr package which allows
you to specify the output filename, e.g. library(knitr);
knit('foo.Rnw', output = 'foo-bar.tex')

Regards,
Yihui
--
Yihui Xie <xieyihui at gmail.com>
Phone: 515-294-2465 Web: http://yihui.name
Department of Statistics, Iowa State University
2215 Snedecor Hall, Ames, IA


On Fri, Jun 15, 2012 at 4:40 AM, Manish Gupta <mandecent.gupta at gmail.com> wrote:
> HI,
>
> I am working on R and Latex.
>
> R CMD Sweave Test.Rnw  (this generates Rnw.Tex file )
>
> R CMD pdflatex Test.tex  (It generated Test.pdf)
>
> Is there any way to change the name of of output file (Test.pdf).  I want it
> to pass the output file name as parameter.
>
> R CMD Sweave Test.Rnw  Output_File
>
> R CMD pdflatex Output_File.tex
>
> So output file name will be Output_File.pdf
>
> Regards
>



More information about the R-help mailing list