如何使用R访问隐藏的系统文件? [英] How can I access hidden system files with R?

查看:41
本文介绍了如何使用R访问隐藏的系统文件?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我是Mac用户.每当我想访问位于/Users/user_name/Library/Mail 文件夹中的Mail文件夹时;RStudio只会忽略它,不会显示任何文件.

  setwd("/Users/user_name/Library/Mail")`list.dirs("/用户/用户名/库/邮件")>人物(0)list.files("/Users/user_name/Library/Mail")>人物(0) 

我了解到,由于对这些文件的访问需要管理员授权,因此R无法访问它们.是否可以授予管理员对R的访问权限以访问隐藏的系统文件?

这个问题是

注意:我也有 R Rscript ,但是窗格太小,无法显示它们.

另外请注意,我确实看到了

  nw_path_close_fd无法关闭受保护的necp fd 22 [9:错误的文件描述符] 

在这些尝试中 Console.app 中的

和我对 list.dirs() 的调用似乎挂起,但这只是需要一段时间b/c我在那儿有大量的文件夹/文件(谢谢,gmail).

我将使用 list.dirs()中的 recursive = FALSE 逐步尝试它,直到您确认一切正常为止.

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.

解决方案

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.

这篇关于如何使用R访问隐藏的系统文件?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆