[R] extracting data using strings as delimiters

lucy b lucy.lists at gmail.com
Tue Sep 25 22:39:11 CEST 2007


Dear List,

I have an ascii text file with data I'd like to extract. Example:

Year Built:  1873 Gross Building Area:  578 sq ft
Total Rooms:  6 Living Area:  578 sq ft

There is a lot of data I'd like to ignore in each record, so I'm
hoping there is a way to use strings as delimiters to get the data I
want (e.g. tell R to take data between "Built:" and "Gross" -
incidentally, not always numeric). I think an ugly way would be to
start at the end of each record and use a substitution expression to
chip away at it, but I'm afraid it will take forever to run. Is there
a way to use strings as delimiters in an expression?

Thanks in advance for ideas.

LB



More information about the R-help mailing list