[R] Partially reading a file (particularly)

From: Tobin, Jared <TobinJR_at_DFO-MPO.GC.CA>
Date: Tue, 29 May 2007 17:33:05 -0230


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




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
surface		Martin Luther King Jr. Blvd.	1590		1234
freeway		608					4583
freeway		808					2386
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

R-help_at_stat.math.ethz.ch mailing list
PLEASE do read the posting guide http://www.R-project.org/posting-guide.html
and provide commented, minimal, self-contained, reproducible code.
Received on Tue 29 May 2007 - 20:15:45 GMT

Archive maintained by Robert King, hosted by the discipline of statistics at the University of Newcastle, Australia.
Archive generated by hypermail 2.2.0, at Tue 29 May 2007 - 23:31:24 GMT.

Mailing list information is available at https://stat.ethz.ch/mailman/listinfo/r-help. Please read the posting guide before posting to the list.