在R中打开100个文件

TOP*_*MAD 3 r file

我需要用数据读取许多文件,但我无法使其工作.

例如:我有6个ASCII文件名为"雨,风等......"

这就是我的想法:

namelist<-c("rain","wind","sunshine hour","radiation","soil moisture","pressure")
for (i in 1:6){
 metedata<-read.table('d:/namelist[i].txt')
 metedata
}
Run Code Online (Sandbox Code Playgroud)

但那没用.我该怎么办?

jub*_*uba 8

试试这个 :

namelist<-c("rain","wind","sunshine hour","radiation","soil moisture","pressure")
for (name in namelist){
 metedata<-read.table(paste0('d:/',name,'.txt')
 metedata
}
Run Code Online (Sandbox Code Playgroud)