Learn R Programming

spatstat (version 1.55-0)

shift.ppp: Apply Vector Translation To Point Pattern

Description

Applies a vector shift to a point pattern.

Usage

# S3 method for ppp
shift(X, vec=c(0,0), …, origin=NULL)

Arguments

X

Point pattern (object of class "ppp").

vec

Vector of length 2 representing a translation.

Ignored

origin

Character string determining a location that will be shifted to the origin. Options are "centroid", "midpoint" and "bottomleft". Partially matched.

Value

Another point pattern (of class "ppp") representing the result of applying the vector shift.

Details

The point pattern, and its window, are translated by the vector vec.

This is a method for the generic function shift.

If origin is given, then it should be one of the character strings "centroid", "midpoint" or "bottomleft". The argument vec will be ignored; instead the shift will be performed so that the specified geometric location is shifted to the origin. If origin="centroid" then the centroid of the window will be shifted to the origin. If origin="midpoint" then the centre of the bounding rectangle of the window will be shifted to the origin. If origin="bottomleft" then the bottom left corner of the bounding rectangle of the window will be shifted to the origin.

See Also

shift, shift.owin, periodify, rotate, affine

Examples

Run this code
# NOT RUN {
  data(cells)
  X <- shift(cells, c(2,3))
  
# }
# NOT RUN {
  plot(X)
  # no discernible difference except coordinates are different
  
# }
# NOT RUN {
  plot(cells, pch=16)
  plot(shift(cells, c(0.03,0.03)), add=TRUE)

  shift(cells, origin="mid")
# }

Run the code above in your browser using DataLab