Hello. I have a question for Rmarkdown users. Is there any way to give a name to the output document inside the Rmd? For example, my rmd's name is "bb.Rmd" but when I knitr to pdf I want it to name the pdf differently than "bb.pdf", for example, "doc1.pdf". Is there any way to do this? Thank you very much ------ Aurora Gonz?lez Vidal Secci?n Apoyo Estad?stico. Servicio de Apoyo a la Investigaci?n (SAI). Vicerrectorado de Investigaci?n. Universidad de Murcia Edif. SACE . Campus de Espinardo. 30100 Murcia @. aurora.gonzalez2 at um.es T. 868 88 7315 F. 868 88 7302 www.um.es/sai www.um.es/ae [[alternative HTML version deleted]]
Dear Aurora, You acn try specifying a YAML block in the Rmd file and then render() it with the rmarkdown package. --- title: "Your title" output: pdf_document: pandoc_args: [ "--output=doc1.pdf" ] --- Note that I haven't tested it. Best regards, ir. Thierry Onkelinx Instituut voor natuur- en bosonderzoek / Research Institute for Nature and Forest team Biometrie & Kwaliteitszorg / team Biometrics & Quality Assurance Kliniekstraat 25 1070 Anderlecht Belgium To call in the statistician after the experiment is done may be no more than asking him to perform a post-mortem examination: he may be able to say what the experiment died of. ~ Sir Ronald Aylmer Fisher The plural of anecdote is not data. ~ Roger Brinner The combination of some data and an aching desire for an answer does not ensure that a reasonable answer can be extracted from a given body of data. ~ John Tukey 2015-07-06 14:24 GMT+02:00 AURORA GONZALEZ VIDAL <aurora.gonzalez2 at um.es>:> Hello. > I have a question for Rmarkdown users. > > Is there any way to give a name to the output document inside the Rmd? > > For example, my rmd's name is "bb.Rmd" but when I knitr to pdf I want it to > name the pdf differently than "bb.pdf", for example, "doc1.pdf". Is there > any way to do this? > > Thank you very much > > > ------ > Aurora Gonz?lez Vidal > > Secci?n Apoyo Estad?stico. > Servicio de Apoyo a la Investigaci?n (SAI). > Vicerrectorado de Investigaci?n. > Universidad de Murcia > Edif. SACE . Campus de Espinardo. > 30100 Murcia > > @. aurora.gonzalez2 at um.es > T. 868 88 7315 > F. 868 88 7302 > www.um.es/sai > www.um.es/ae > > [[alternative HTML version deleted]] > > ______________________________________________ > R-help at r-project.org mailing list -- To UNSUBSCRIBE and more, see > https://stat.ethz.ch/mailman/listinfo/r-help > PLEASE do read the posting guide > http://www.R-project.org/posting-guide.html > and provide commented, minimal, self-contained, reproducible code.[[alternative HTML version deleted]]
There is no direct way to get it, but you can get 1) the input filename via knitr::current_input(), and 2) the output format via knitr::opts_knit$get('rmarkdown.pandoc.to'). You may be able to figure out the output filename based on these two pieces of information. Regards, Yihui -- Yihui Xie <xieyihui at gmail.com> Web: http://yihui.name On Mon, Jul 6, 2015 at 7:24 AM, AURORA GONZALEZ VIDAL <aurora.gonzalez2 at um.es> wrote:> Hello. > I have a question for Rmarkdown users. > > Is there any way to give a name to the output document inside the Rmd? > > For example, my rmd's name is "bb.Rmd" but when I knitr to pdf I want it to > name the pdf differently than "bb.pdf", for example, "doc1.pdf". Is there > any way to do this? > > Thank you very much > > > ------ > Aurora Gonz?lez Vidal > > Secci?n Apoyo Estad?stico. > Servicio de Apoyo a la Investigaci?n (SAI). > Vicerrectorado de Investigaci?n. > Universidad de Murcia > Edif. SACE . Campus de Espinardo. > 30100 Murcia > > @. aurora.gonzalez2 at um.es > T. 868 88 7315 > F. 868 88 7302 > www.um.es/sai > www.um.es/ae
Am 06.07.2015 um 14:24 schrieb AURORA GONZALEZ VIDAL:> Hello. > I have a question for Rmarkdown users. > > Is there any way to give a name to the output document inside the Rmd? > > For example, my rmd's name is "bb.Rmd" but when I knitr to pdf I want it to > name the pdf differently than "bb.pdf", for example, "doc1.pdf". Is there > any way to do this?Here is another way of changing the output filename. I am using it from R's commandline: rmarkdown::render( input="filename_orig.R", output_format="pdf_document", output_file="filename_different.pdf" ) Greetings, Rainer Hurling> > Thank you very much > > > ------ > Aurora Gonz?lez Vidal > > Secci?n Apoyo Estad?stico. > Servicio de Apoyo a la Investigaci?n (SAI). > Vicerrectorado de Investigaci?n. > Universidad de Murcia > Edif. SACE . Campus de Espinardo. > 30100 Murcia > > @. aurora.gonzalez2 at um.es > T. 868 88 7315 > F. 868 88 7302 > www.um.es/sai > www.um.es/ae