Re: [R] extracting data using strings as delimiters

2007-09-26 Thread lucy b
All great ideas. I tried strsplit first and it worked, but thanks everyone! Best- LB On 9/25/07, Gabor Grothendieck <[EMAIL PROTECTED]> wrote: > 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 gsu

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) str

Re: [R] extracting data using strings as delimiters

2007-09-25 Thread Ted Harding
On 25-Sep-07 20:39:11, 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 th

Re: [R] extracting data using strings as delimiters

2007-09-25 Thread jim holtman
Here is one way. You can setup a list of the patterns to match against and then apply it to the string. I am not sure what the rest of the text file look like, but this will return all the values that match. > x <- readLines(textConnection("Year Built: 1873 Gross Building Area: 578 sq > ft +

Re: [R] extracting data using strings as delimiters

2007-09-25 Thread Marc Schwartz
On Tue, 2007-09-25 at 16:39 -0400, 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

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

[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 da