Quantcast
Channel: Active questions tagged r - Stack Overflow
Viewing all articles
Browse latest Browse all 201945

Officer package - Error in absolute_path(target)

$
0
0

Within my function, if I run each line manually I can save normally in docx through the office package. However, when rotating the function the following error appears:

Error in absolute_path(target) : 'x' must be a single character string
Além disso: Warning messages:
1: Removed 1 rows containing non-finite values (stat_bin). 
2: In if (!grepl(x = target, pattern = "\\.(docx)$", ignore.case = TRUE)) stop(target,  :

 Error in absolute_path(target) : 'x' must be a single character string

The warning message 1 I know where it is from, but I don't know how to handle this error.

I believe the error is in this part:

doc <- read_docx()
    doc<-doc %>%
      body_add_flextable(par) %>%
      body_add_par("", style = "Normal") %>% # blank paragraph
      body_add_par("", style = "Normal") %>% # blank paragraph
      body_add_flextable(vopa) %>%
      body_add_par("", style = "Normal") %>% # blank paragraph
      body_add_par("", style = "Normal") %>% # blank paragraph
      body_add_gg(diam) %>%
      body_add_par("", style = "Normal") %>% # blank paragraph
      body_add_par("", style = "Normal") %>% # blank paragraph
      body_add_flextable(vtt) %>%
      body_add_par("", style = "Normal") %>% # blank paragraph
      body_add_par("", style = "Normal") %>% # blank paragraph
      body_add_flextable(phi) %>%
      body_add_par("", style = "Normal") %>% # blank paragraph
      body_add_par("", style = "Normal") %>% # blank paragraph
      body_add_flextable(ft) %>%
      body_add_par("", style = "Normal") %>% # blank paragraph
      body_add_par("", style = "Normal") %>% # blank paragraph
      body_add_gg(gg) %>%
      body_add_par("", style = "Normal") %>% # blank paragraph
      body_add_par("", style = "Normal") %>% # blank paragraph
      body_add_gg(sa)
      end<-"end"

      }


  if(pt==T){
  fileout <- tempfile(fileext = ".docx")
  fileout <- paste(getwd(),"/Inventario Florestal - ",nm,".docx",sep="")
  print(doc, target = fileout)
  }else{
    fileout <- tempfile(fileext = ".docx")
    fileout <- paste(getwd(),"/Forest Inventory - ",nm,".docx",sep="")
  print(doc, target = fileout)

  }

Viewing all articles
Browse latest Browse all 201945

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>