我想用R处理大量文件,有些文件的名称中包含非ASCII字符,如下所示。
但是,我无法使用list.files()
正确读取文件名。
> (files <- list.files("~/files", full.names = TRUE))
[1] "C:\\Users\\murakama\\Documents/files/2002_88_2_Stepniewski.txt"
[2] "C:\\Users\\murakama\\Documents/files/2003_100_2-3_Sai¨dou.txt"
当然,我也无法根据名称阅读文件。
> scan(files[1])
Error in file(file, "r") : cannot open the connection
In addition: Warning message:
In file(file, "r") :
cannot open file 'C:\Users\murakama\Documents/files/2002_88_2_Stepniewski.txt': No such file or directory
> scan(files[2])
Error in file(file, "r") : cannot open the connection
In addition: Warning message:
In file(file, "r") :
cannot open file 'C:\Users\murakama\Documents/files/2003_100_2-3_Sai¨dou.txt': No such file or directory
这个问题在Windows上运行R是独一无二的,因为当我在Mac上运行R时不会发生这种情况。有谁知道如何在Windows的R中读取这些文件?