marks.linnet: Marks of a Network

View source: R/linnet.R

marks.linnetR Documentation

Marks of a Network

Description

Extract or change the marks attached to vertices or segments of a linear network.

Usage

## S3 method for class 'linnet'
marks(x, of=c("segments", "vertices"), ...)           

## S3 replacement method for class 'linnet'
marks(x, of=c("segments", "vertices"), ...) <- value

Arguments

x

Linear network (object of class "linnet").

of

Character string (partially matched) specifying whether the marks are attached to the vertices of the network (of="vertices") or to the line segments of the network (of="segments", the default).

...

Ignored.

value

Vector or data frame of mark values, or NULL.

Details

These functions extract or change the marks attached to the network x. They are methods for the generic functions marks and marks<- 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 marks(x, of) <- NULL.

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).

Value

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).

Author(s)

\spatstatAuthors

.

See Also

linnet, marks, marks<-

Examples

  L <- simplenet
  marks(L, "vertices") <- letters[1:nvertices(L)]
  marks(L, "segments") <- runif(nsegments(L))
  L
  marks(L, "v")
  marks(L, "s")

spatstat.linnet documentation built on Nov. 2, 2023, 6:10 p.m.