Re: [R] Reading mixed tables

2008-11-29 Thread Hesen Peng
That's a very good idea! Thanks a lot. On Sat, Nov 29, 2008 at 9:13 PM, Gabor Grothendieck <[EMAIL PROTECTED]> wrote: > Try this. First we read it in using fill = TRUE so that > lines with one number get filled out with NAs. The first > line is T so assign first cell to T and create DF0 which >

Re: [R] Reading mixed tables

2008-11-29 Thread Gabor Grothendieck
Try this. First we read it in using fill = TRUE so that lines with one number get filled out with NAs. The first line is T so assign first cell to T and create DF0 which does not have that line. Then split the data into a list of data frames starting each group at the line with the NA in column

Re: [R] Reading mixed tables

2008-11-29 Thread Hesen Peng
Yes. I'm just for killing time in the rainy weekend. Now I'm using readLines() to read the file and then output the data as a list. google.read.list <- function(filename){ temp <- readLines(filename) out <- NULL tt <- NULL for(i in 1:length(temp)){ strin <- as.numeric(strsplit(temp[i],

Re: [R] Reading mixed tables

2008-11-29 Thread David Winsemius
Have you looked at the documentation and help files for R Import/Export; http://cran.r-project.org/doc/manuals/R-data.pdf and the read functions ?read.table ?readLines ?count.fields This is pretty basic stuff. After an extremely cursory look at that problem I was guessing that it is more lik

[R] Reading mixed tables

2008-11-29 Thread Hesen Peng
Dear R buddies, This weekend I became interested in solving Google Code Jam problems using R. I guess R may work very well in this kind of contests but the input of file has been a problem for me. Take this case for example (http://code.google.com/codejam/contest/dashboard?c=agdjb2RlamFtchALEghjb2