# joinVertices

##### Join Vertices in a Network

Join the specified vertices in a linear network, creating a new network.

##### Usage

`joinVertices(L, from, to)`

##### Arguments

- L
A linear network (object of class

`"linnet"`

) or point pattern on a linear network (object of class`"lpp"`

).- from,to
Integers, or integer vectors of equal length, specifying the vertices which should be joined. Alternatively

`from`

can be a 2-column matrix of integers and`to`

is missing or`NULL`

.

##### Details

Vertices of the network are numbered by their order of appearance
in the point pattern `vertices(L)`

.

If `from`

and `to`

are single integers, then the
pair of vertices numbered `from`

and `to`

will be
joined to make a new segment of the network.
If `from`

and `to`

are vectors of integers, then
vertex `from[i]`

will be joined to vertex `to[i]`

for
each `i = 1,2,..`

.

If `L`

is a network (class `"linnet"`

), the result is
another network, created by adding new segments.
If `L`

is a point pattern on a network (class `"lpp"`

), the
result is another point pattern object, created by adding new segments to
the underlying network, and retaining the points.

In the resulting object, the new line segments are appended to the existing list of line segments.

##### Value

A linear network (object of class `"linnet"`

)
or point pattern on a linear network (object of class `"lpp"`

).

##### See Also

##### Examples

```
# NOT RUN {
snet <- joinVertices(simplenet, 4, 8)
plot(solist(simplenet, snet), main="")
X <- runiflpp(3, simplenet)
Y <- joinVertices(X, 4, 8)
# }
```

*Documentation reproduced from package spatstat, version 1.57-1, License: GPL (>= 2)*