Re: [R] Parsing Files in R (USGS StreamFlow data)

2009-10-05 Thread Gabor Grothendieck
Repeat the DD calculation but with this pattern instead: pat - ^# +USGS +([0-9]+) +(.*) and then merge DD with DF: DDdf - data.frame(gauge = as.numeric(DD[,1]), gauage_name = DD[,2]) both - merge(DF, DDdf, by = gauge, all.x = TRUE) On Sun, Oct 4, 2009 at 10:14 PM, Gabor Grothendieck

[R] Parsing Files in R (USGS StreamFlow data)

2009-10-04 Thread stephen sefick
http://waterdata.usgs.gov/nwis/uv?format=rdbperiod=7site_no=021973269 I would like to be able to parse this file up: I can do this x - read.table(http://waterdata.usgs.gov/nwis/uv?format=rdbperiod=7site_no=021973269;, skip=26) but If I add another gauge to this x -

Re: [R] Parsing Files in R (USGS StreamFlow data)

2009-10-04 Thread Gabor Grothendieck
Its not completely clear what you want to preserve and what you want to eliminate but try this: L - readLines(http://waterdata.usgs.gov/nwis/uv?format=rdbperiod=7site_no=021973269,06018500;) L.USGS - grep(^USGS, L, value = TRUE) DF - read.table(textConnection(L.USGS), fill = TRUE) head(DF)

Re: [R] Parsing Files in R (USGS StreamFlow data)

2009-10-04 Thread Rolf Turner
On 5/10/2009, at 2:49 PM, stephen sefick wrote: http://waterdata.usgs.gov/nwis/uv? format=rdbperiod=7site_no=021973269 I would like to be able to parse this file up: I can do this x - read.table(http://waterdata.usgs.gov/nwis/uv? format=rdbperiod=7site_no=021973269, skip=26) but If I add

Re: [R] Parsing Files in R (USGS StreamFlow data)

2009-10-04 Thread stephen sefick
Thanks for the help - this was my goal sorry for not being straight forward enough #021973269 is the Waynesboro Gauge on the Savannah River Proper (SRS) #02102908 is the Flat Creek Gauge (ftbrfcms) #02133500 is the Drowning Creek (ftbrbmcm) #02341800 is the Upatoi Creek Near Columbus (ftbn)