[R] extracting data using strings as delimiters

2007-09-25 Thread lucy b
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

Re: [R] extracting data using strings as delimiters

2007-09-25 Thread Katharine Mullen
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

Re: [R] extracting data using strings as delimiters

2007-09-25 Thread Gabor Grothendieck
Perhaps you could clarify what the general rule is but assuming that what you want is any word after a colon it can be done with strapply in the gsubfn package like this: Lines - c(Year Built: 1873 Gross Building Area: 578 sq ft, Total Rooms: 6 Living Area: 578 sq ft) library(gsubfn)