I have the rstudio addin package located here .
One of the additives allows the user to define a directory and copy the file that is in the package to this directory.
file is located:
atProjectManageAddins/inst/Docs/RMarkdownSkeleton.Rmd
And I'm trying to copy it to a user directory with something like this:
file.copy("inst/Docs/RMarkdownSkeleton.Rmd", paste0(Dir, FolderName, "/Reports/", FolderName, "_report.Rmd"))
Where am I trying to copy it from where it is in the package, where it defines it (based on two separate arguments, Dir and FolderName ).
But this does not seem to work. My assumption is that I am not looking at the package directory correctly. I tried ./Inst/ , ~/Inst/ and maybe a couple more. Now my assumption is that there is a more systematic reason for my inability to work file.copy() .
Any suggestions? Is it possible?
Please note that if I run the function locally through source() and runGadget() , it works fine. Only when the package is installed, and I use the graphical interface of adding RStudio, where it refers to the package with the installation, does it work. Thus, I am quite sure that I am not correctly defining the file path for the installed .Rmd files.
Edit: I changed to the following based on Carl's suggestion (as seen on github), but the files are still not being copied.
file.copy(system.file("Docs","Rmarkdownskeleton.rmd",package="atProjectManageAd‌​dins"), paste0(Dir, FolderName, "/Reports/", FolderName, "_report.Rmd"))