Read in only the first n lines of a csv file in R -
Read in only the first n lines of a csv file in R -
i want header of csv file in r, not sure best way is.
i thought
read.csv(readlines("file.csv", n=3))
might work, of course of study output of readlines
isn't valid connection. thought perhaps there's clever stdin
here, can't figure out.
i'm looking improve writing readlines output file , reading in, or manually implementing header parsing read.csv does. (of course of study approaches work seem bit crude; more i'm trying understand how best redirect text connection).
there nrows=
argument read.table()
passed through.
example:
r> dim(read.csv("/usr/local/lib/r/site-library/fortunes/fortunes/fortunes.csv", + nrows=3, header=true, sep=";")) [1] 3 5 r>
(pardon sep=";"
wanted pick file we'd both have ...)
r csv
Comments
Post a Comment