r将多个txt文件读入多个数据帧

时间:2015-04-09 11:12:12

标签: regex r

我需要将多个txt文件读入单独的向量中,并且我仍然坚持使用该脚本。

这一次调用工作正常:

setwd("~/Documents/DSC")
options(stringsAsFactors = FALSE)
j1<-read.table("qBlog 1 .txt", encoding="latin1")
j2<-read.table("qBlog 2 .txt", encoding="latin1")

但是当我尝试拨打电话时:

for(i in 1:10)
{
  oname = paste("./blogSample/qBlog ", i, sep="")
  assign(oname, read.table(paste("\"",oname, " .txt\"",",encoding=\"latin1\"", sep="")))

我收到以下错误

Error in file(file, "rt") : cannot open the connection
In addition: Warning message:
In file(file, "rt") :
  cannot open file '"./blogSample/qBlog 1 .txt",encoding="latin1"': Invalid argument

我认为这是一个正则表达式问题,但我看不出我做错了什么!!

任何帮助将不胜感激

0 个答案:

没有答案
相关问题