RMarkdown package flextable fails immediately with “read_docx only support docx”

前端 未结 2 807
余生分开走
余生分开走 2021-01-19 18:05

I\'m sorry for a minimally produced question...... not lots of information because it just fails the first time I\'m ever trying with this and I am not very skilled in RMar

相关标签:
2条回答
  • 2021-01-19 18:26

    I just tried your example and changed a thing or two. I will post my code underneath. However, be aware, that the package you meant is not dbplyr but dplyr. The first one is for databases, the latter for extract, transform and load. Here is the code:

    library(dplyr)
    library(flextable)
    library(datasets)
    
    data(iris)
    
    iris[1:10,] %>%
          flextable()
    

    With that code, it perfectly knits to word (.docx) on my machine.

    0 讨论(0)
  • 2021-01-19 18:41

    omg -- it's because the filepath for my reference_docx has spaces (maybe other chars also)

    I didn't check for other special characters yet, so may be other characters, but for sure space is enough to break it.

    My original file path was (partially redacted with same length items for letters and numbers)

    C:\Zzzzz\yyyy\XxxXxxxx\--------1111,1111 aaaaaaa bbbb cccc\ffffd e.f. !\_-_ ggggg hhhhh iiii jjjjjjj kkkkk\R source\_outputTemplates\  
    

    I tried making it really short and also simple to see if this by chance is the problem, because I hadn't tried it yet and I keep thinking... we know it's a local issue so it must be something like this.

    So I jumped it up to

    C:\Zzzzz\yyyy\Qqqqqq\  
    
    • and it works!

    So to debug the type of character that is a problem, I made a folder to play with, and started with spaces...

    C:\Zzzzz\yyyy\Qqqqqq\a folder with spaces\  
    

    ==> ERR !

    Changing to same length but no spaces...

    C:\Zzzzz\yyyy\Qqqqqq\aFolderWithNooSpaces\  
    

    ==> ok :) !!!

    I might check for other special characters, but this is already more than enough debugging, I think ;-)
    I'm sure the dev can take it from here. The github says they follow the tag.

    0 讨论(0)
提交回复
热议问题