| marks.linnet | R Documentation |
Extract or change the marks attached to vertices or segments of a linear network.
## S3 method for class 'linnet'
marks(x, of=c("segments", "vertices"), ...)
## S3 replacement method for class 'linnet'
marks(x, of=c("segments", "vertices"), ...) <- value
## S3 method for class 'linnet'
unmark(X)
x, X |
Linear network (object of class |
of |
Character string (partially matched)
specifying whether the marks are attached
to the vertices of the network ( |
... |
Ignored. |
value |
Vector or data frame of mark values,
or |
These functions extract or change the marks
attached to the network x.
They are methods for the generic functions
marks,
marks<-
and unmark
for the class "linnet" of linear networks.
A linear network may include a set of marks attached to the line segments, and a separate set of marks attached to the vertices. Each set of marks can be a vector, a factor, or a data frame.
The expression marks(x, of) extracts the marks from x.
The assignment marks(x, of) <- value assigns new marks to the
dataset x, and updates the dataset x in the current
environment.
The argument of specifies whether we are referring to
the segments or the vertices.
For the assignment marks(x, "segments") <- value, the value
should be a vector or factor of length equal to the number of
segments in x, or a data frame with as many rows
as there are segments in x.
If value is a single value,
or a data frame with one row, then it will be replicated
so that the same marks will be attached to each segment.
Similarly for marks(x, "vertices") <- value the number of
marks must match the number of vertices.
To remove marks, use unmark(x) to remove all marks,
or marks(x, of) <- NULL to remove the specified kind of marks.
To extract the vertices (including their marks) as a point pattern,
use vertices(x). To extract the segments (including their
marks) as a line segment pattern, use as.psp(x).
For marks(x), the result is a vector, factor or data frame,
containing the mark values attached to the vertices or the
segments of x.
If there are no marks, the result is NULL.
For marks(x) <- value, the result is the updated network
x (with the side-effect that the dataset x is updated in
the current environment).
.
linnet,
marks,
marks<-
L <- simplenet
marks(L, "vertices") <- letters[1:nvertices(L)]
marks(L, "segments") <- runif(nsegments(L))
L
marks(L, "v")
marks(L, "s")
unmark(L)
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.