Could not fetch png resource created by magick in a child document

I've recently discovered child documents in Rmarkdown, which allows me to work on large analyses section by section. I am passing the rendered html document back to the parent with results='asis'

After some initial problems sourcing images, I discovered normalizePath() which allows paths me to find files regardless of whether the file is knit as a a standalone file during debugging or knit as a child eg

![(#fig:QC) text label](r normalizePath("../../data/myHtml)){width=100%}

knitr::include_graphics(normalizePath("../reportFigs/myFig.png"))

However, I'm running into some issues with the magick package.

Everything works fine when it is run standalone as a child, but I run into problems when I run the .Rmd file from the parent.

After reading in the requested pngs and doing some manipulation, it dumps the final figure into the cache in myParent_files but then doesn't retrieve it from there.

Currently I've implemented a workaround where I save the file to a results directory and retrieve it with the above knit::include-graphics() command.

Is there a more elegant solution that does not involve an external file save?

This topic was automatically closed 21 days after the last reply. New replies are no longer allowed.

If you have a query related to it or one of the replies, start a new topic and refer back with a link.