How can I access hidden system files with R?

浪子不回头ぞ 提交于 2021-01-27 05:57:53

问题


I am Mac User. Whenever I want to access Mail folder located in the /Users/user_name/Library/Mail folder; RStudio just ignores it and doesn't show any files.

setwd("/Users/user_name/Library/Mail")`

list.dirs("/Users/user_name/Library/Mail")
> character(0)

list.files("/Users/user_name/Library/Mail")
> character(0)

I understand that because of access to these files requires admin authorization, the R cannot access them. Is there a way to grant admin access to R to access hidden system files?

This question is cross-posted on RStudio Community forum two days ago. Unfortunately, I couldn't get a reply. That's why I asked here again.

Edit: Both of list.files() and list.dirs() return nothing.


回答1:


Add both the R executable and RStudio executable (drag their icons) to the Full Disk Access element under the Privacy tab of System Preferences => Security & Privacy:

NOTE: I also have R and Rscript in there but the pane is too small to show them.

Also NOTE that I do see

nw_path_close_fd Failed to close guarded necp fd 22 [9: Bad file descriptor]

in the Console.app on these attempts and my call to list.dirs() appears to hang but it's just taking a while b/c I have a ton of folders/files under there (thanks, gmail).

I'd try it incrementally with recursive=FALSE in list.dirs() until you've verified everything is working.

This post has some links that provide background on this new sandboxed filesystem behaviour.



来源:https://stackoverflow.com/questions/53223774/how-can-i-access-hidden-system-files-with-r

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