1

Preface: I have found a similar thread on this topic and ran the steps denoted and it has not fixed the issue, so do not mark as duplicate (also have tried install.packages("gdtools")).

I'm using RMarkdown to templatize a Word document that requires a nicer looking table than what you can do within regular Markdown and am trying to use flextable package to do so so.

I can run a sample within an R Script, and get the following:

library(flextable)
ft <- flextable(head(mtcars))
ft <- autofit(ft)
ft

flextable runs in r script

I can run an R code chunk in RMarkdown in RStudio, and get this:

library(flextable)
ft <- flextable(head(mtcars))
ft <- autofit(ft)
ft

flextable in RMarkdown code chunk

When I try to knit, I get the following error:

Error: package or namespace load failed for 'flextable' in dyn.load(file, DLLpath = DLLpath, ...): unable to load shared object '/Library/Frameworks/R.framework/Versions/3.6/Resources/library/gdtools/libs/gdtools.so': dlopen(/Library/Frameworks/R.framework/Versions/3.6/Resources/library/gdtools/libs/gdtools.so, 6): Library not loaded: /opt/X11/lib/libcairo.2.dylib Referenced from: /Library/Frameworks/R.framework/Versions/3.6/Resources/library/gdtools/libs/gdtools.so Reason: image not found Execution halted

How do I get this to Knit into my Word Document?

dre
  • 474
  • 5
  • 19
  • Have you tried `install.packages("gdtools")`? – Marius Aug 02 '19 at 00:54
  • yes that as well, has not helped (and i just edited question to denote that as well). – dre Aug 02 '19 at 00:55
  • I have tried to knit to HTML and Word. Your code works fine for both on my computer. I wonder if upgrading packages or R could help. – Zhiqiang Wang Aug 02 '19 at 00:56
  • 1
    I think there are issues with installing Cairo on OSX. I don't use OSX so I'm not up to date with the best way to do it, see questions like https://stackoverflow.com/questions/38952427/include-cairo-r-on-a-mac – Marius Aug 02 '19 at 01:01

0 Answers0