# methods.linnet: Methods for Linear Networks In spatstat: Spatial Point Pattern Analysis, Model-Fitting, Simulation, Tests

## Description

These are methods for the class `"linnet"` of linear networks.

## Usage

 ``` 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42``` ```as.linnet(X, ...) ## S3 method for class 'linnet' as.linnet(X, ..., sparse) ## S3 method for class 'linnet' as.owin(W, ...) ## S3 method for class 'linnet' as.psp(x, ..., fatal=TRUE) ## S3 method for class 'linnet' nsegments(x) ## S3 method for class 'linnet' nvertices(x, ...) ## S3 method for class 'linnet' pixellate(x, ...) ## S3 method for class 'linnet' print(x, ...) ## S3 method for class 'linnet' summary(object, ...) ## S3 method for class 'linnet' unitname(x) ## S3 replacement method for class 'linnet' unitname(x) <- value vertexdegree(x) ## S3 method for class 'linnet' vertices(w) ## S3 method for class 'linnet' volume(x) ## S3 method for class 'linnet' Window(X, ...) ```

## Arguments

 `x,X,object,w,W` An object of class `"linnet"` representing a linear network. `...` Arguments passed to other methods. `value` A valid name for the unit of length for `x`. See `unitname`. `fatal` Logical value indicating whether data in the wrong format should lead to an error (`fatal=TRUE`) or a warning (`fatal=FALSE`). `sparse` Logical value indicating whether to use a sparse matrix representation, as explained in `linnet`. Default is to keep the same representation as in `X`.

## Details

The function `as.linnet` is generic. It converts data from some other format into an object of class `"linnet"`. The method `as.linnet.lpp` extracts the linear network information from an `lpp` object.

The other functions are methods for the generic commands `as.owin`, `as.psp`, `nsegments`, `nvertices`, `pixellate`, `print`, `summary`, `unitname`, `unitname<-`, `vertices`, `volume` and `Window` for the class `"linnet"`.

The methods `as.owin.linnet` and `Window.linnet` extract the window containing the linear network, and return it as an object of class `"owin"`.

The method `as.psp.linnet` extracts the lines of the linear network as a line segment pattern (object of class `"psp"`) while `nsegments.linnet` simply counts the number of line segments.

The method `vertices.linnet` extracts the vertices (nodes) of the linear network and `nvertices.linnet` simply counts the vertices. The function `vertexdegree` calculates the topological degree of each vertex (the number of lines emanating from that vertex) and returns these values as an integer vector.

The method `pixellate.linnet` applies `as.psp.linnet` to convert the network to a collection of line segments, then invokes `pixellate.psp`.

## Value

For `as.linnet` the value is an object of class `"linnet"`. For other functions, see the help file for the corresponding generic function.

## Author(s)

`linnet`.

Generic functions: `as.owin`, `as.psp`, `nsegments`, `nvertices`, `pixellate`, `print`, `summary`, `unitname`, `unitname<-`, `vertices`, `volume` and `Window`.

Special tools: `thinNetwork`, `insertVertices`, `joinVertices`, `connected.linnet`.

`lixellate` for dividing segments into shorter segments.

## Examples

 ```1 2 3 4 5 6 7 8``` ``` simplenet summary(simplenet) nsegments(simplenet) nvertices(simplenet) pixellate(simplenet) volume(simplenet) unitname(simplenet) <- c("cubit", "cubits") Window(simplenet) ```

### Example output

```Loading required package: spatstat.data

spatstat 1.59-0       (nickname: 'J'ai omis les oeufs de caille')
For an introduction to spatstat, type 'beginner'

Note: R version 3.4.4 (2018-03-15) is more than 9 months old; we strongly recommend upgrading to the latest version
Linear network with 10 vertices and 10 lines
Enclosing window: rectangle = [0, 1] x [0, 1] units
Linear network with 10 vertices and 10 lines
Total length 2.904852 units
Maximum vertex degree: 4
[Non-sparse matrix representation]
Network is connected
Diameter: 1.248943 units
Numerical tolerance: 0.0001501466 units
Enclosing window: rectangle = [0, 1] x [0, 1] units
 10
 10
real-valued pixel image
128 x 128 pixel array (ny, nx)
enclosing rectangle: [0, 1] x [0, 1] units
 2.904852
window: rectangle = [0, 1] x [0, 1] cubits
```

spatstat documentation built on March 26, 2020, 8:04 p.m.