Skip to content
Prev 312271 / 398506 Next

Speeding reading of large file

Once you've read the data with readLines()

head(raw) gets you the first 6 lines or
head(nchar(raw)) the lengths of those lines

Once you know which row has the headers (here it is 2), just use

names(dta) <- read.table(text=raw[2], stringsAsFactors=FALSE)

to add column names to the data frame.

-------
David