[R] extracting data using strings as delimiters

Katharine Mullen kate at few.vu.nl
Tue Sep 25 23:07:07 CEST 2007


have you seen help(strsplit)?

On Tue, 25 Sep 2007, lucy b wrote:

> 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
>
> ______________________________________________
> R-help at r-project.org mailing list
> https://stat.ethz.ch/mailman/listinfo/r-help
> PLEASE do read the posting guide http://www.R-project.org/posting-guide.html
> and provide commented, minimal, self-contained, reproducible code.
>



More information about the R-help mailing list