I am knitting an Rmarkdown as a docx file and I have a template file for the formatting. Everything works fine with the rendering, however, once the process is completed, the template file disappears.
I have tried rendering the Rmd via the YAML and the rmarkdown::render function, but in both cases I get the same result.
Here are snippets of what I have tried:
#Render function
library(rmarkdown)
library(lubridate)
ruta = paste0(getwd(),'/scripts/random forest')
rmd.files = list.files(ruta, pattern ='.Rmd', full.names = T)
modelo_cr = render(rmd.files[1],
output_file = paste0('reporte_fwl_cr_',
format(ymd(Sys.Date()),'%d_%b_%Y'),
'.docx'),
output_dir = 'results/costa rica',
output_format = word_document(reference_docx = 'template.docx'),
envir = new.env())
#YAML Header
---
output:
word_document:
reference_docx: template.docx
---
Thanks in advance for any help you may provide.