The column names are run through make.names
before being returned. Quotes are not valid characters for column names. You can see the difference by running:
make.names(c('"userId"', "fullName"))
[1] "X.userId." "fullName"
From the make.names
help:
A syntactically valid name consists of letters, numbers and the dot or underline characters and starts with a letter or the dot not followed by a number. ... The character "X" is prepended if necessary. All invalid characters are translated to ".".
A suggestion would be to call read.csv
skipping the first line, and not including a header to get the bulk of the data.
dd <- read.csv("~/Desktop/dbdump/users.txt", na.strings = "\\N",
quote="", nrows = 1000, header = FALSE, skip = 1)
You can then read in the column names using scan
(which is what read.csv
is calling under the hood)
names(dd) <- scan("~/Desktop/dbdump/users.txt", what = character(), nlines=1,sep =',')