Over the past years, I built a R package and regularly updated it in Windows 7 Enterprise. Everything was working fine until November 2017 when the company upgraded my desktop. I got a brand new machine with windows 10. As 'permission' issue is kind of common, so I as usual installed R, Rstudio, Rtools into a folder I have write access. But when I tried to build the package in Rstudio, I got the below error:
==> devtools::check()
Updating RCfun documentation
Loading RCfun
Setting env vars --------------------------------------------------------------
CFLAGS : -Wall -pedantic
CXXFLAGS: -Wall -pedantic
Building RCfun ----------------------------------------------------------------
"C:/R/R-34~1.2/bin/x64/R" --no-site-file --no-environ --no-save --no-restore \
--quiet CMD build "Z:\_R\R_package\RCfun" --no-resave-data --no-manual
* checking for file 'Z:\_R\R_package\RCfun/DESCRIPTION' ... OK
* preparing 'RCfun':
* checking DESCRIPTION meta-information ... OK
* checking for LF line-endings in source and make files and shell scripts
* checking for empty or unneeded directories
* looking to see if a 'data/datalist' file should be added
* building 'RCfun_0.1.1.tar.gz'
Warning in gzfile(tarfile, "wb", compression = compression_level) :
cannot open compressed file 'C:/Windows/System32/RCfun_0.1.1.tar.gz',
probable reason 'Permission denied'
Error in gzfile(tarfile, "wb", compression = compression_level) :
cannot open the connection
Execution halted
Error: Command failed (1)
Execution halted
Exited with status 1.
Clearly, I don't have access to the folder 'C:/Windows/System32/'. I can't change that and I am aware of that, so I installed R related stuff all in a folder I have access to. But the question is, why it still attempts to write the file RCfun_0.1.1.tar.gz into the folder 'C:/Windows/System32/' when building the package? Where can I change/overwrite that behavior?
I have searched for answers from time to time for the past a couple of month, but got no luck. I found something similar in this thread: permission denied error while building/checking R package on WIndows but it doesn't solve my case.
I know it must be related to some system path that directs to this folder 'C:/Windows/System32/'. I tried Sys.setenv(PATH=) to remove that folder. I'm not sure if that's the correct way, but it doesn't help anyway. Is there a way that I can catch where it goes wrong? Thanks.