[R-sig-Geo] merging data with a dataframe based on a common identifier
stephen sefick
ssefick at gmail.com
Fri Jul 17 20:18:58 CEST 2009
Do you have advice on how to order streams?
regards
Stephen Sefick
On Sun, Jul 12, 2009 at 5:32 PM, Roger Bivand<Roger.Bivand at nhh.no> wrote:
> On Sun, 12 Jul 2009, stephen sefick wrote:
>
>> I have used v.strahler in GRASS to calculate the stream order. This
>> module writes its results to a text file. The line column of the
>> output data is the common name between the two data sets. I would
>> like to attach the stream order to the streams vector. I have looked
>> at the data once in R with
>>
>> pseudocode:
>> streams <- readVECT6("streams")
>> str(streams)
>
> Well, v.strahler is a very fresh GRASS addon, not a regular part of GRASS,
> and does require a clean topology. Running it on streams in spearfish, with
> the elevation.dem DEM, gives an output vector map, say st_o0:
>
> v.strahler --verbose --overwrite input=streams output=st_o0 \
> dem=elevation.dem txout=st_o0.txt sloppy=0 layer=1
>
>
> st_o0 <- readVECT6("st_o0", type="line,boundary", with_c=TRUE,
> remove.duplicates=FALSE, plugin=FALSE)
>
> gets 116 lines. They agree with the first 116 of 119 lines in st_o0.txt:
>
> tbl <- read.table("st_o0.txt", skip=1, header=TRUE)
>
> by plotting. For example:
>
> plot(st_o0, col=rainbow(27)[tbl[1:116,]$Basin.])
>
> looks plausible. However, where the streams are not fully connected, basins
> get split, with obvious consequences for the order. The cat in the vector
> layer seems to be the order too, as stated on the help page - I think that
> this is where the graphics on the help page are coming from. I think that
> this agrees with advice that your got on the grass-users list. It may be
> that you need to check the cleanness of the topology of the stream lines
> carefully - this is repeated on the help page. You may also need to read the
> v.strahler code to check what it is assigning, as:
>
> plot(st_o0, col=tbl[1:116,]$Order.)
>
> or equivalently:
>
> plot(st_o0, col=st_o0$cat)
>
> don't match my view of drainage in spearfish.
>
> Hope this helps
>
> Roger
>
>>
>> and it is a huge list. I am not sure the best way to tackle this problem.
>> thanks for any help,
>>
>>
>
> --
> Roger Bivand
> Economic Geography Section, Department of Economics, Norwegian School of
> Economics and Business Administration, Helleveien 30, N-5045 Bergen,
> Norway. voice: +47 55 95 93 55; fax +47 55 95 95 43
> e-mail: Roger.Bivand at nhh.no
>
>
--
Stephen Sefick
Let's not spend our time and resources thinking about things that are
so little or so large that all they really do for us is puff us up and
make us feel like gods. We are mammals, and have not exhausted the
annoying little problems of being mammals.
-K. Mullis
More information about the R-sig-Geo
mailing list