addVertices {spatstat.linnet}R Documentation

Add New Vertices to a Linear Network

Description

Adds new vertices to a linear network at specified locations outside the network.

Usage

addVertices(L, X, join=NULL, joinmarks=NULL)

Arguments

L

Existing linear network (object of class "linnet") or point pattern on a linear network (object of class "lpp").

X

Point pattern (object of class "ppp") specifying the new vertices.

join

Optional information specifying how to join the new vertices X to the existing network. See Details. If join=NULL (the default), the new vertices are simply added to the list of network vertices without being joined to the rest of the network.

joinmarks

Optional vector or data frame of marks associated with the new edges specified by join.

Details

This function adds new vertices to an existing linear network L, at specified locations X outside the network.

The argument L can be either a linear network (class "linnet") or some other object that includes a linear network.

The new vertex locations are points outside the network, specified as a point pattern X (object of class "ppp").

The argument join specifies how to join the new vertices to the existing network.

The result is the modified object, with an attribute "id" such that the ith added vertex has become the id[i]th vertex of the new network.

Value

An object of the same class as L representing the result of adding the new vertices. The result also has an attribute "id" as described in Details.

Author(s)

Adrian Baddeley

See Also

insertVertices to insert vertices along an existing network.

as.lpp, linnet, methods.linnet, joinVertices, thinNetwork.

Examples

   opa <- par(mfrow=c(1,3))
   L <- simplenet
   X <- runifpoint(20, Window(simplenet))
   plot(L)
   plot(X, add=TRUE, cols="green", pch=16, cex=2)
   plot(addVertices(L, X, "nearest"), col="red")
   plot(L, add=TRUE, col="grey", lwd=3)
   plot(X, add=TRUE, cols="green", pch=16, cex=2)
   plot(addVertices(L, X, "vertices"), col="red")
   plot(L, add=TRUE, col="grey", lwd=3)
   plot(X, add=TRUE, cols="green", pch=16, cex=2)
   par(opa)

[Package spatstat.linnet version 3.2-1 Index]