I recently set up an R Studio cloud workspace as a backup for our Forwards package development workshop:
It contains some example packages (mylittlepony and hadcol) and allows collaborators (workshop participants) to create their own package projects (as I have done in mypkg).
I was pleased to see that build tools and git were already set up - perfect! However I found that users could not build a package from a standard set up, i.e. where the package directory = the project directory. This is because they do not have permission to create the tarball outside the project directory.
I tried to solve the problem by putting the package in a subdirectory and configuring the build tools to set that directory as the package directory. This does mean that "Build Source Package" from the build menu works (as well as everything else on the build menu) however most participants preferred to type R commands directly in the console and all the devtools functions then require the subdirectory to be specified, which caused a lot of confusion because that wasn't on the workshop slides. Moreover some usethis functions do not have the option to specify a subdirectory, e.g. use_vignette(), though in that case devtools::use_vignette() can be used instead.
So at the moment there are a couple of options:
- Change the workshop slides to use subdirectories all the time or explain when we need to do this - not ideal, as this is not the structure that we recommend in general and it just adds that extra level of complication for an introductory workshop.
- Use the standard setup, but if working in RStudio cloud don't build the package. Okay, but then there is still an issue with check: using devtools::check() in the console works, but using check from the build menu doesn't (permissions issue again, not sure why there's a difference here).
I guess 2 is the best solution if we want to use RStudio.cloud to teach package development, as then most things work as standard with just a couple of things where we have to say "this won't work in the cloud".
But maybe RStudio.cloud could be set up somehow to allow the standard workflow? Perhaps create the project directories in a subdirectory, e.g. cloud/user/project, so the user could write files to the level above the project directory? Or somehow make it work so these auxiliary files from build/check get put in a temp directory?