1

I am having a constant error rendering an rmarkdown file through the officedown package. It's no use for me to include reproducible code here because the error is random. My yaml is:

---
date: "`r str_to_title(format(Sys.time(), '%B, %Y'))`"
#author: "Florestal Package"
title: "Relatório Técnico de Inventário Florestal"
output: 
  officedown::rdocx_document:
    reference_docx: "template.docx"
    tables:
      style: 'Grid Table 1 Light'
      caption:
        style: Table Caption
        pre: 'Tabela '
        sep: '. '
    plots:
      caption:
        style: Image Caption
        pre: 'Figura '
        sep: '. '
    page_margins:
      bottom: 0.78
      top: 1.18
      right: 0.78
      left: 1.18
      header: 0.78
      footer: 0.78
      gutter: 0

---

And my code to render is:

rmarkdown::render('Inventario_Florestal_Relatorio_Tecnico_ACS.Rmd',
                  output_file = paste(getwd(),'/myfile',
                                      '.docx', sep=''),
                  encoding="UTF-8")  

Randomly, the following error appears, each time I render, assigned to a different line, and after a few tries, finally the document is saved in my folder.

Quitting from lines 49-52 (teste_.Rmd)
Error in zip::unzip(zipfile = file, exdir = folder) : 
  zip error: `Failed to set mtime on `word/theme/theme1.xml` while extracting `C:\Users\igorc\Documents\Backup 2022\Florestal_Rmarkdown\florestal_rmarkdown\template.docx`` in file `zip.c:260`

I tried to run the rmarkdown file with a much smaller code, and the error disappeared. I think it might have to do with the size of the code, which is a little big to render. Would anyone know the reason?

Igor Cobelo
  • 419
  • 3
  • 12
  • My first suspect would be some external process which is locking files. Perhaps an antivirus or search indexer. Or is this path synced to some cloud service by any chance? – margusl Feb 24 '23 at 07:19

0 Answers0