Learn R Programming

spatstat.linnet (version 3.5-0)

marks.linnet: Marks of a Network

Description

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

Usage

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

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

# S3 method for linnet unmark(X)

Arguments

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

Details

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

See Also

linnet, marks, marks<-

Examples

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

Run the code above in your browser using DataLab