R/headtail.R

Defines functions head.ppp

Documented in head.ppp

#'
#'     headtail.R
#'
#'   Methods for head() and tail()
#'
#'   $Revision: 1.2 $  $Date: 2022/01/04 05:30:06 $

head.tess <- head.psp <- head.ppx <- head.ppp <- function(x, n=6L, ...) {
  stopifnot(length(n) == 1L)
  xlen <- nobjects(x)
  n <- if (n < 0L) max(xlen + n, 0L) else min(n, xlen)
  x[seq_len(n)]
}

tail.tess <- tail.psp <- tail.ppx <- tail.ppp <- function (x, n = 6L, ...) {
  stopifnot(length(n) == 1L)
  xlen <- nobjects(x)
  n <- if (n < 0L) max(xlen + n, 0L) else min(n, xlen)
  x[seq.int(to = xlen, length.out = n)]
}

Try the spatstat.geom package in your browser

Any scripts or data that you put into this service are public.

spatstat.geom documentation built on Sept. 18, 2024, 9:08 a.m.