最近更新了R到4.3.0,发现使用list.files()无法获取超过4个中文字符的纯中文文件。但是在文件名前加一个英文字符就能正确获取,有谁知道这个是bug还是什么?怎么能解决么?
R4.3.0使用list.files读取文件列表超出4个中文字符无法读取?
- 已编辑
可能和这个变更有关:
R on Windows is now able to work with path names longer than 260 characters when these are enabled in the system (requires at least Windows 10 version 1607). Packages should be updated to work with long paths as well, instead of assuming
PATH_MAX
to be the maximum length. Custom front-ends and applications embedding R need to update their manifests if they wish to allow this feature. See https://blog.r-project.org/2023/03/07/path-length-limit-on-windows for more information.
可以试试 fs::dir_ls()
.
1 年 后
nan.xiao 大神真给力!!!我也遇到了同样问题!
5 天 后
这个错误仅在 R 4.3.3及之后的版本修复。R4.3.0不包含此修复。
* list.files() on Windows now returns also files with names longer
that 260 bytes (the Windows limit is 260 characters).
Previously, some file names particularly with 'East Asian'
characters were omitted.