How to "save as web page" as stand-alone HTML, and change the cache.path/fig.path or base.directory

Hi RStudio community!

I'm building a slideshow using the .Rpres file type conveniently provided by the RStudio IDE. My working group has an .ini. file we all use to standardize the location of files on different personal computers and VMs. I want to include the .Rpres file in our GitHub repo. but would like to use the .ini file to save the figures and cache output from the .Rpres file to another local folder.

To do the above, I first read in the .ini file and then set the base directory to the shared location. This then points the figures and caches to be placed relative to this directory (see example below).

The problem with this process, is that I'd like to share the HTML file that is produced when clicking 'save to web page', as a stand-alone file. This works great when I don't set the base directory in knitr, and I get an HTML file that can be passed around without the figure PNGs. Unfortunately when the base directory is set, the HTML file is no longer stand-alone, but rather, the images are all pointing to a specific location locally. I've tried setting the self.contained option to TRUE but that didn't work.I've also tried to look into how the .Rpres file is being processed in RMarkdown but I'm not even sure what underlying functions are being called, or even the presentation type .Rpres uses. I've also tried setting cache and figure paths, while leaving the base directory alone. I can't seem to find the right flag or path to set that will give me the desired result.

Does anyone have any suggestions for creating a standalone HTML file from the .Rpres file type while also setting the base directory so caches and figure (PNG) files are not included in the GitHub repo.? Below I've given an example of my setup chunk in the .Rpres file.

library(ini)
local = read.ini(local_paths.ini)

knitr::opts_knit$set(base.dir=local$path)

Any help would be much appreciated!
Kyle

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