External Resource Files - Interactive R Markdown docs

Hello, I'm attempting to deploy an interactive rmarkdown document with the shiny runtime that reads in a config file which should be deployed with it. However, when I output list.files() and getwd() from within the document, a tmp directory is given and no config files are listed. An "invalid description" error is given when I try to read in the config file.

Here is my deployment code:

rsconnect::deployApp(appDir = ".", appFiles = c("Example Portal.Rmd", "config_portal1.yaml" ), appPrimaryDoc = "Example Portal.Rmd", appName = "example_portal_1", appTitle = "Example Portal 1 of 23", forceUpdate = TRUE)

The reason for this design is so that we can deploy (and update) many variants of the same document from an R script.

Thanks!

This is definitely an interesting use case! I believe R Markdown files are rendered in a separate working directory (the temp directory you mention). As a result, to make sure the config file lands in the directory with you, I think you may need to specify the config file in resource_files: in the YAML header, perhaps?

A simple example is here:

Yes, it works when I specify the config file in resource_files, but since I'm trying to deploy multiple variants at once (confg1.yaml, config2.yaml ... configN.yaml), I need a way to make sure the file is included in the deployApp() call and always kept with in the working directory or to programmatically populate resources_files.

I have tried r list.files(pattern = "config")[1] in resource_files to no avail.

Hmm... maybe try !expr list.files(pattern = "config")[1] ? I think that is the convention used within the YAML to specify code. I'll see if I can take a pass at this later!

1 Like

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