[R] [newbie] read row from file into vector
Tom_Roche at pobox.com
Thu Dec 29 23:08:30 CET 2011
Tom Roche 11-12-29 3:51 PM
>>> E.g., for a file such that
>>> $ head -n 2 ~/data/foo.csv | tail -n 1
>>> I'd like to be able to populate a vector 'v' s.t.
>>> v=5718, ... v=0
Duncan Murdoch Thu, 29 Dec 2011 16:45:45 -0500
>> x <- read.csv("foo.csv", nrow=1)
>> x <- as.numeric(x[1,]) # convert to numeric vector
William Dunlap Thu, 29 Dec 2011 21:49:13 +0000
> Look into connection objects, which let you open a file or other
> readable sort of thing and read it piece by piece.
Will do, since what I plan to use R for (mostly) is manipulating very large netCDF files.
thanks, all! Tom Roche <Tom_Roche at pobox.com>
More information about the R-help