An embedded and charset-unspecified text was scrubbed... Name: not available URL: <https://stat.ethz.ch/pipermail/r-sig-geo/attachments/20120226/8747b2d8/attachment.pl>
count how many row i have in a txt file in a directory
3 messages · gianni lavaredo, Rainer Hurling, Robert J. Hijmans
On 26.02.2012 15:03 (UTC+1), gianni lavaredo wrote:
Dear Researchers, I have a large TXT (X,Y,MyValue) file in a directory and I wish to import row by row the txt in a loop to save only the data they are inside a buffer (using inside.owin of spatstat) and delete the rest. The first step before to create a loop row-by-row is to know how many rows there are in the txt file without load in R to save memory problem.
If I remember right from another thread, you are on Max OSX?
If so, you could try Unix alike commands like 'wc' (word count) with
option 'l' for lines:
#as.numeric(unlist(strsplit(system("wc -l file.txt", intern=TRUE),
split=" "))[2])
I suspect, there must be other, much more elegant methods ...
Rainer
some people know the specific function? thanks in advance for all suggestions Gianni
An embedded and charset-unspecified text was scrubbed... Name: not available URL: <https://stat.ethz.ch/pipermail/r-sig-geo/attachments/20120226/b912fbc7/attachment.pl>