Learn R Programming

spatstat.linnet (version 3.4-0)

as.linfun: Convert Data to a Function on a Linear Network

Description

Convert some kind of data to an object of class "linfun" representing a function on a linear network.

Usage

as.linfun(X, ...)

# S3 method for linim as.linfun(X, ...)

# S3 method for linnet as.linfun(X, ..., values=marks(X))

# S3 method for lintess as.linfun(X, ..., values=marks(X), navalue=NA)

# S3 method for linim as.function(x, ...)

# S3 method for linnet as.function(x, ...)

# S3 method for lintess as.function(x, ...)

Value

Object of class "linfun".

Arguments

X,x

Some kind of data to be converted.

...

Other arguments passed to methods.

values

Optional. Vector of function values, one entry associated with each tile of the tessellation.

navalue

Optional. Function value associated with locations that do not belong to a tile of the tessellation.

Author

Adrian Baddeley Adrian.Baddeley@curtin.edu.au, Rolf Turner rolfturner@posteo.net and Ege Rubak rubak@math.aau.dk.

Details

An object of class "linfun" represents a function defined on a linear network. This page documents methods for converting other kinds of objects to a "linfun" object.

The function as.linfun is generic. There are methods for converting linear networks (class "linnet"), pixel images on a linear network (class "linnet") and tessellations on a linear network (class "lintess") to functions on a network. Equivalent methods are also provided for the generic as.function.

The methods as.linfun.linim and as.function.linim convert objects of class "linim" (pixel images on a linear network) to functions on the network.

The methods as.linfun.linnet and as.function.linnet converts a linear network (object of class "linnet") to a function on the network. The function values are specified by the argument values. It should be a vector with one entry for each segment of the network; any point lying on segment number i will return the value values[i]. If values is missing or NULL, the function values are taken to be the marks attached to the segments (values=marks(X)); if there are no marks attached to the segments, the function value is the integer index of the segment (values=seq_len(nsegments(X))).

The methods as.linfun.lintess and as.function.lintess convert a tessellation on a linear network into a function with a different value on each tile of the tessellation. The function values are specified by the argument values. It should be a vector with one entry for each tile of the tessellation; any point lying in tile number i will return the value values[i]. If values is missing, the marks of the tessellation are taken as the function values. If values is missing and the tessellation has no marks, or if values is given as NULL, then the function returns factor values identifying which tile contains each given point.

See Also

linfun

Examples

Run this code
   X <- runiflpp(2, simplenet)
   Y <- runiflpp(5, simplenet)

   # image on network
   D <- density(Y, 0.1)

   f <- as.linfun(D)
   f
   f(X)

   h <- as.linfun(simplenet)

   # tessellation on network
   Z <- lineardirichlet(Y)
   g <- as.linfun(Z)
   g(X)
   h <- as.linfun(Z, values = runif(5))
   h(X)

Run the code above in your browser using DataLab