R软件初学者,读取txt文件总是错误,黑色图片是源数据,白色图片是代码,望好心人能够指点一二,不胜感激~~
为了方便查看,我试过的代码列一下:
read.table(file="Tax_History_148_1804_10 (2007).txt", sep="|", header=T)
Error in read.table(file = "Tax_History_148_1804_10 (2007).txt", sep = "|", :
列的数目比列的名字要多
>
read.table(file="Tax_History_148_1804_10 (2007).txt", sep="|", header=T, fileEncoding = "utf-8")
Error in read.table(file = "Tax_History_148_1804_10 (2007).txt", sep = "|", :
列的数目比列的名字要多
> )
Error: unexpected ')' in ")"
>
read.table(file="Tax_History_148_1804_10 (2007).txt", sep="|", header=T,skip=1)
Error in read.table(file = "Tax_History_148_1804_10 (2007).txt", sep = "|", :
列的数目比列的名字要多
>
read.table(file="Tax_History_148_1804_10 (2007).txt", sep="|", header=T,nrows=10,skip=1)
Error in read.table(file = "Tax_History_148_1804_10 (2007).txt", sep = "|", :
列的数目比列的名字要多
>
dat <- read.table("Tax_History_148_1804_10 (2007).txt", sep="|", header=T, nrows=10, skip=1)
Error in read.table("Tax_History_148_1804_10 (2007).txt", sep = "|", header = T, :
列的数目比列的名字要多
>
dat <- read.table("Tax_History_148_1804_10 (2007).txt", sep="|", header=F, nrows=10, skip=1)
Error in scan(file = file, what = what, sep = sep, quote = quote, dec = dec, :
line 1 did not have 248 elements
>
dat <- read.table("Tax_History_148_1804_10 (2007).txt", sep="|", header=F, nrows=10, skip=2)
Error in scan(file = file, what = what, sep = sep, quote = quote, dec = dec, :
line 1 did not have 248 elements
>
dat <- read.table("Tax_History_148_1804_10 (2007).txt", sep="|", header=F, nrows=2:10)
Error in scan(file = file, what = what, sep = sep, quote = quote, dec = dec, :
line 1 did not have 148 elements
In addition: Warning message:
In if (nrows < 0L) 5 else min(5L, (header + nrows)) :
the condition has length > 1 and only the first element will be used
>
read.table(file="Tax_History_148_1804_10 (2007).txt", sep="|", header=T, nrows=10, skip=2, Encoding = "utf-8")
Error in read.table(file = "Tax_History_148_1804_10 (2007).txt", sep = "|", :
unused argument (Encoding = "utf-8")
> r
ead.table(file="Tax_History_148_1804_10 (2007).txt", sep="|", header=T, nrows=10, skip=2, fileEncoding = "utf-8")
Error in read.table(file = "Tax_History_148_1804_10 (2007).txt", sep = "|", :
列的数目比列的名字要多
>