Re: [R] read.table and variable length of tables

2012-06-14 Thread Halldór Björnsson
Thanks and with datlines <- as.data.frame(inp[( grep("", inp)[1]+5 ):(grep("", inp)[1]-1)]); I get the data as needed. Thanks again H. - Original Message - On Jun 14, 2012, at 10:23 AM, Halldór Björnsson wrote: > Hi, > > I am trying to read in weather balloon data, where each file

Re: [R] read.table and variable length of tables

2012-06-14 Thread Halldór Björnsson
Thanks, even better - Original Message - On Jun 14, 2012, at 12:18 PM, Halldór Björnsson wrote: > Thanks and with > > datlines <- as.data.frame(inp[( grep("", inp)[1]+5 ):(grep(" PRE>", inp)[1]-1)]); > I suggest this instead. > read.fwf(textConnection(datlines), widths=rep(7,11)) V1

Re: [R] read.table and variable length of tables

2012-06-14 Thread David Winsemius
On Jun 14, 2012, at 12:18 PM, Halldór Björnsson wrote: Thanks and with datlines <- as.data.frame(inp[( grep("", inp)[1]+5 ):(grep("PRE>", inp)[1]-1)]); Er, ... are you sure? I got a factorized mess when I did that. > str(datlines) 'data.frame': 98 obs. of 1 variable: $ inp[(grep("", i

Re: [R] read.table and variable length of tables

2012-06-14 Thread David Winsemius
On Jun 14, 2012, at 12:18 PM, Halldór Björnsson wrote: Thanks and with datlines <- as.data.frame(inp[( grep("", inp)[1]+5 ):(grep("PRE>", inp)[1]-1)]); I suggest this instead. > read.fwf(textConnection(datlines), widths=rep(7,11)) V1V2V3V4 V5 V6 V7 V8V9 V10

Re: [R] read.table and variable length of tables

2012-06-14 Thread David Winsemius
On Jun 14, 2012, at 10:23 AM, Halldór Björnsson wrote: Hi, I am trying to read in weather balloon data, where each file has a header of fixed length and a trailing section of a fixed length. The data section (the table) is of variable length. An example of the data is on: http://weather

[R] read.table and variable length of tables

2012-06-14 Thread Halldór Björnsson
Hi, I am trying to read in weather balloon data, where each file has a header of fixed length and a trailing section of a fixed length. The data section (the table) is of variable length. An example of the data is on: http://weather.uwyo.edu/cgi-bin/sounding?region=naconf&TYPE=TEXT%3ALIST&YEAR