net.group {stream.net} | R Documentation |
Classify stream segment or stream link attributes for
use by net.map
.
net.group (net, segatt=NULL, linkatt=NULL, ngroups=5, method="quantile", spread=NULL)
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. |
One of segatt
or linkatt
must not be
NULL
.
A list with the following components:
group | vector of group numbers for each segment |
cuts | vector of break points for the classification |
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.
names
of the group
vector are set
to the sid
s so that net.map
will
work correctly.
Denis White, white.denis@epa.gov
# 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))