Possible Duplicate:
Some issues trying to read a file with cbc.read.table function in R + using filter while reading files故障与cbc.read.table功能中的R
一)我想根据我经历了什么从colbycol
包河读一个比较大的.txt文件与功能cbc.read.table
当我们有大文件时(读取R中的GB多于一个),读取这个包使得工作更容易,而且我们不需要所有的列/变量来进行分析。另外,我读了功能cbc.read.table
可以支持相同的read.table
的参数。但是,如果我传递参数nrows
(为了让我在R档的预览)我得到以下错误:
#My line code. I'm just reading columns 5,6,7,8 out of 27
i.can <- cbc.read.table("xxx.txt", header = T, sep = "\t",just.read=5:8, nrows=20)
#error message
Error in read.table(file, nrows = 50, sep = sep, header = header, ...) :
formal argument "nrows" matched by multiple actual arguments
所以,我的问题是:你能告诉我怎样才能解决这个问题?
B)之后,我试图读取用下面的代码的所有实例:
i.can.b <- cbc.read.table("xxx.txt", header = T, sep = "\t",just.read=4:8) #done perfectly
my.df <- as.data.frame(i.can.b) #getting error in this line
Error in readSingleKey(con, map, key) : unable to obtain value for key 'Company' #Company is a string column in my data set
所以,我的问题又是:我该如何解决这个问题?
c)您是否知道在阅读文件时可以过滤(通过实例条件)的方式?