net.group {stream.net}R Documentation

Classify Stream Attribute for Mapping

Description

Classify stream segment or stream link attributes for use by net.map.

Usage

  net.group (net, segatt=NULL, linkatt=NULL, 
    ngroups=5, method="quantile", spread=NULL)

Arguments

net A net.object.
segatt attribute associated with each segment. If segatt is a character vector of length one, then get attribute from net$segs$segatt, else assume segatt is a numeric vector of length equal to number of segments and in correct order.
linkatt attribute associated with each link. If linkatt is a character vector of length one, then get attribute from net$links$linkatt, else assume linkatt is a numeric vector of length equal to number of links and in correct order.
ngroups the number of groups to create.
method currently must be "quantile" or "equalInterval". method = "quantile" means quartiles, quintiles, etc., depending on ngroups. "method = equalInterval" means dividing the range of the attribute into ngroups equal intervals.
spread if not NULL, then, for "equalInterval" classification, set the range of intervals to be the two element spread vector.

Details

One of segatt or linkatt must not be NULL.

Value

A list with the following components:
group vector of group numbers for each segment
cuts vector of break points for the classification
The group vector is always of length the number of segments. If the attribute is provided by link, the attribute is associated with all segments in the link.
The names of the group vector are set to the sids so that net.map will work correctly.

Author(s)

Denis White, white.denis@epa.gov

See Also

net.object net.map

Examples

  # Q model random net
  net <- net.qmodel (10)
  net <- net.addsegs (net)

  # classify some attributes
  class1 <- net.group (net, linkatt="shreve", 
    method="equalInterval")
  class2 <- net.group (net, segatt="length")
  att <- seq (nrow (net$segs))
  class3 <- net.group (net, segatt=att)

  # map
  n <- length (table (class1$group))
  net.map (net, group=class1$group, col=rev(terrain.colors(n)))
  n <- length (table (class2$group))
  net.map (net, group=class2$group, col=gray(0:n/n))
  n <- length (table (class3$group))
  net.map (net, group=class3$group, col=rainbow(n))

[Package stream.net version 1.0.6 Index]