Become an expert in R — Interactive courses, Cheat Sheets, certificates and more!
Get Started for Free

Replace.linim

Reset Values in Subset of Image on Linear Network


Description

Reset the values in a subset of a pixel image on a linear network.

Usage

## S3 replacement method for class 'linim'
x[i, j] <- value

Arguments

x

A pixel image on a linear network. An object of class "linim".

i

Object defining the subregion or subset to be replaced. Either a spatial window (an object of class "owin"), or a pixel image with logical values, or a point pattern (an object of class "ppp"), or any type of index that applies to a matrix, or something that can be converted to a point pattern by as.ppp (using the window of x).

j

An integer or logical vector serving as the column index if matrix indexing is being used. Ignored if i is appropriate to some sort of replacement other than matrix indexing.

value

Vector, matrix, factor or pixel image containing the replacement values. Short vectors will be recycled.

Details

This function changes some of the pixel values in a pixel image. The image x must be an object of class "linim" representing a pixel image on a linear network.

The pixel values are replaced according to the rules described in the help for [<-.im. Then the auxiliary data are updated.

Value

The image x with the values replaced.

Author(s)

Adrian Baddeley Adrian.Baddeley@curtin.edu.au, Rolf Turner r.turner@auckland.ac.nz and Ege Rubak rubak@math.aau.dk.

See Also

Examples

# make a function
  Y <- as.linim(distfun(runiflpp(5, simplenet)))
  # replace some values
  B <- square(c(0.25, 0.55))
  Y[B] <- 2
  plot(Y, main="")
  plot(B, add=TRUE, lty=3)
  X <- runiflpp(4, simplenet)
  Y[X] <- 5

spatstat.linnet

Linear Networks Functionality of the 'spatstat' Family

v2.1-1
GPL (>= 2)
Authors
Adrian Baddeley [aut, cre], Rolf Turner [aut], Ege Rubak [aut], Ottmar Cronie [ctb], Tilman Davies [ctb], Greg McSwiggan [ctb], Suman Rakshit [ctb]
Initial release
2021-03-28

We don't support your browser anymore

Please choose more modern alternatives, such as Google Chrome or Mozilla Firefox.