r - rmarkdown::render leads to error when output_file path is absolute -
i have r package, 1 of function - produce report. in inst/markdown have template rep.rmd in package function producereport() have code:
render.file <-"rep.rmd" render.file <- system.file(templates.path, render.file, package=getpackagename()) render.dir <- dirname(render.file) pdf.file <- "example.pdf" rmarkdown::render(render.file , quiet = false, output_format = "pdf_document", output_file = pdf.file)
it works.
but if change last line to:
rmarkdown::render(render.file , quiet = false, output_format = "pdf_document", output_file = "d:/help/me/please/example.pdf")
it not work (all paths exist). have error
"! undefined control sequence. \grffile@filename ->d:\help \me\please\example _files/figure-... l.148 ...example_files/figure-latex/unnamed-chunk-2-1}"
pandoc.exe: error producing pdf show traceback rerun debug error: pandoc document conversion failed error 43 "
when use variant on linux server works
p.s.
i emphasize, problem not in paths (i use standard procedure file.path() avoid system problems, path in example demonstration).
maybe it's not workaround, works on win
lol <- rmarkdown::render(render.file , quiet = true, output_format = "pdf_document") file.rename(lol, pdf.file)
Comments
Post a Comment