You can pass options for R CMD INSTALL with the INSTALL_opts argument:
## agridat has a bunch of datasets and no dependencies
install.packages("agridat", INSTALL_opts = "--no-data")
data(package = "agridat")
# no data sets found
I don't think there's a way to set an option in .Rproj files, but R does look for and run "profile" code when it starts a session. It will run any file named .Rprofile in the working directory on start-up. Run ?Startup for the documentation.
Note: R will look for and run an .Rprofile file in the working directory and then your home directory, but will stop once it finds one. So, if you have an .Rprofile file in both directories, only the one in the working directory will be run. So it might be a good idea to tack this onto the end of any project-specific .Rprofile script:
home_profile <- file.path(Sys.getenv("HOME"), ".Rprofile")
if (file.exists(home_profile)) {
source(home_profile)
}
rm(home_profile)
Note 2: My success is spotty with providing the argument and replacing install.packages. The package always installs, but sometimes includes the datasets. I have no idea why.
I think I am happy with the behaviour of it only using the .Rprofile in the current working directory, as I tend not to use a global .Rprofile. But for others the addon might just be perfect.
Seems to be sufficient to tackle the problem I am having, I will test it out.