Re: [R] Help with parsing a data file

2008-03-06 Thread Henrique Dallazuanna
Try this: lines <- readLines('yourfile') newLines <- lines[-(1:(13+3))] coln <- scan(textConnection(lines[3]), what="") lapply(which(nchar(newLines) == 4), function(x)read.table(textConnection(newLines[seq(x + 1, x + 13)]), col.names=coln)) On 06/03/2008, sean <[EMAIL PROTECTED]> wrote: > Hi Al

Re: [R] Help with parsing a data file

2008-03-06 Thread Peter Alspach
Sean I'm sure there are many ways of doing this. I assume you have read the data in R as a data.frame with 24 columns and 2+1+13+(1+13)*n rows, where n is the number of years, and that you want a data.frame with 25 columns (one extra for year) and 13*n rows (although I am not sure why 13 MOnths)