0

I am running into a problem when I knit RMD files to docx files. I used to include flextable objects that were previously saved as .rds files in my RMD files using read_rds() so when I knit the document, the tables would be printed out in the .docx file.

I have just updated R to version 4.2.2, and now it gives me this error when I try to knit RMD to docx

I don't face the same error when I try to knit the document to PDF or HTML

Error in x$data[i, j] <- value : number of items to replace is not a multiple of replacement length Calls: .main ... keep_wn -> [<- -> [<-.par_struct -> [<- -> [<-.fpstruct

  • When you updated R, you probably also change your flextable version. The objects you stored in the rds are probably incompatible with the current version. Do you have a way to determine what version was used to create those objects? Try using that version. Or you'll need to recreated the rds files using the current version. It's easier to help you if you include a simple [reproducible example](https://stackoverflow.com/questions/5963269/how-to-make-a-great-r-reproducible-example) with sample input that can be used to test and verify possible solutions. – MrFlick Nov 16 '22 at 20:16
  • I was just about to write the solution. It's exactly as you said. I re-created the rds files and everything worked! – Abdullah Abdelaziz Nov 16 '22 at 20:37

0 Answers0