Reputation: 681
There is a strange thing when i use read.table to get data.
data=read.table('/home/tiger/nasdaqlisted.txt',head=T,sep='|')
dim(data)
[1] 750 6
in fact,there are 2454 lines in the file,what's wrong?
http://freeuploadfiles.com/bb3cwypih2d2
Upvotes: 1
Views: 1460
Reputation: 18749
I think the issue comes from the fact that some of the names contain the quote character '
(in names such as Angie's List, Inc.
).
The default argument in read.table
for quote
being "\"'"
it needs to be changed for your data to be read correctly.
read.table("path/to/file", header=TRUE, sep="|", quote="")
As per @mrdwab suggestion, read.delim
having "\""
as default quote
argument will work without needing any change:
read.delim("path/to/file", header=TRUE, sep="|")
Upvotes: 5