RStudio: unexpected call to `dir.create()` with the first instruction within a project stored on a network drive

徘徊边缘 提交于 2019-12-12 10:35:59

问题


First, apologies for a lack of a reproducible example, but I cannot really provide one as I believe the problem lies within my network settings. Please treat this question as a call for help in debugging the issue...

After opening in RStudio a project stored on a network drive and running the very first instruction (being it a package load or even a <- 1) I am seeing a really weird output in the console:

> a <- 1
Warning message:
In dir.create(tempPath, recursive = TRUE) :
  cannot create dir 'F:\Marketing', reason 'Permission denied'

I have all possible temp dirs set up in user environment variables (TEMP, TMP, TMPDIR) and Sys.getenv() is printing them correctly.

"F:\Marketing" is a valid path on my network drive and it is a root directory of the project.

I have tried to debugonce(dir.create) in .RProfile to see what the tempPath is, but unfortunately this resulted in an "invalid 'envir' argument" error.

After copying the project to a local drive the problem disappears, so this is clearly a network drive/network setup problem, but I do not know where to dig more and my IT dept. is not really useful here...

Any ideas how to debug this warning?


回答1:


The error message is very clear. It is not about your temp dirs. It is that you need permission to create a folder at the place.

One possibility is that you don't have the permission to create a folder at such places, for example the network drive is shared by many users and normal users don't have the permission to create folders at root directory. If this is the case, no one can give the permission to you except your IT dept, or you can try to create the folder under your own personal folder.

If you believe you have the permission to create the folder, for example you have the sudo permission, maybe you can try using system('sudo mkdir -p tempPath').

Edit: Sorry I didn't notice this is windows system, and sudo is not available. But the idea is similar. Maybe you can try "run as administrator" or something like that.



来源:https://stackoverflow.com/questions/44953046/rstudio-unexpected-call-to-dir-create-with-the-first-instruction-within-a-p

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!