Package losing files

I've created an R package that contains RStudio templates. When the template is used, I want it to copy all files from the skeleton folder to the project folder. The skeleton folder is in the package here:

inst/rstudio/templates/project/prj_skeleton

There are two files: metadata.yml and scratchpad.R

When the package is compiled, everything in the inst folder moves up a level, and so this folder is found using:

skeleton_dir <- system.file("rstudio","templates","project","prj_skeleton", package = "my_pkg", mustWork = TRUE)

However, when I inspect this folder after compilation, the scratchpad.R file is missing.

Does anyone know how to counteract this behaviour? Is it because it is a .R file and so it cannot be copied over? I have other templates which contain .Rmd files and these are fine.

What does .Rbuildignore contain?

Thanks. I am an idiot.

So in my package home directory, I also have a file called scratchpad.R, it's my go to name for where to write random junk pieces of code and testing, which is why I want one when I make new projects. I had already thought ahead previously and added "scratchpad.R" to .Rbuildignore. This matches the one in the home directory and the one in my skeleton folder, so they are both ignored. Quick change to "^scratchpad.R" and it's working now.

Thanks again :smiley:

Thanks. I am an idiot.

Well no, guess how I learn about such mistakes. :joy:

Awesome that your problem is now fixed!

This topic was automatically closed 7 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.