[R] Partially reading a file (particularly)

Tobin, Jared TobinJR at DFO-MPO.GC.CA
Tue May 29 22:03:05 CEST 2007


Hello,

I am trying to figure out if there exists some R command that allows one
to be
particularly selective when reading a file.  I'm dealing with large
fixed-width data 
sets that look like

539001..
639001..
639001..
...
539002..
639002..
...

Presently, I am using read.fwf to read an entire file, but I am
interested only in 
reading those records beginning with 5.  I have been unable to find help
in any of 
the suggested resources.

I understand this is a SAS example that replicates what I'm looking to
do, if it's of
any help to anyone.

street type		name					am
traffic	pm traffic

freeway		408					3684
3459
surface		Martin Luther King Jr. Blvd.	1590		1234
freeway		608					4583
3860
freeway		808					2386
2518
surface		Lake Shore Dr.			1590		1234

INPUT type $ @;
IF type = 'surface' THEN DELETE;
INPUT name $ 9-38 amtraff pmtraff;

Any answers, suggestions, or points-in-the-right-direction would be much
appreciated.

--

Jared Tobin, Student Research Assistant
Dept. of Fisheries and Oceans
tobinjr at dfo-mpo.gc.ca



More information about the R-help mailing list