Re: [R] Way to handle variable length and numbers of columns using read.table(...)

2009-05-05 Thread jim holtman
unt for that. > > Maybe I need to look into what Gabor suggested as well, i.e. > library(gsubfn) > > Thanks again for any feedback and advice on this one, as the data I receive > is out of my control, but I am working with the go get them to fix it as > well. > > > > ---

Re: [R] Way to handle variable length and numbers of columns using read.table(...)

2009-05-04 Thread Gabor Grothendieck
The last line should be as follows (as the previous post missed the time column). The regular expression says either start from beginning (^) and look for a string of digits, [0-9]+, or look for digits [0-9]*, a dot [.] and two more digits [0-9][0-9]. Each time strapply finds such a match as.numer

Re: [R] Way to handle variable length and numbers of columns using read.table(...)

2009-05-04 Thread Jason Rupert
Mon, 5/4/09, jim holtman wrote: > From: jim holtman > Subject: Re: [R] Way to handle variable length and numbers of columns using > read.table(...) > To: jasonkrup...@yahoo.com > Cc: R-help@r-project.org > Date: Monday, May 4, 2009, 9:47 PM > Well if you read in your data, you g

Re: [R] Way to handle variable length and numbers of columns using read.table(...)

2009-05-04 Thread Gabor Grothendieck
Its not clear exactly what the rules are for this but if we assume that numbers always end in a decimal plus two digits then using stapply from the gsubfn package: > Lines <- "Time Loc1 Loc2 + 1 22.33 44.55 + 2 66.77 88.99 + 3 222.33344.55 + 4 66.77 88.99" > > library(gsubfn) > L <- readLines(text

Re: [R] Way to handle variable length and numbers of columns using read.table(...)

2009-05-04 Thread jim holtman
Well if you read in your data, you get: > x <- read.table('clipboard', header=TRUE, fill=TRUE) Warning message: In read.table("clipboard", header = TRUE, fill = TRUE) : incomplete final line found by readTableHeader on 'clipboard' > x Time Loc1 Loc2 1122.33 44.55 22