R/internal-to-ppp.R

Defines functions internal_to_ppp

Documented in internal_to_ppp

#' Data to spatstat format
#' 
#' @param x Pattern in internal format
#' 
#' @export
internal_to_ppp <-function(x) {
  x <- internalise_pp(x) # just to be sure
  win <- if(!is.null(x$owin)) x$owin else as.owin(c(x$bbox))
  coords <- x$coord
  if(x$dim==2)
    ppp(coords[,1], coords[,2], window=win, mark=cbind(mass=x$mass, type=x$type))
  else 
    pp3(coords[,1], coords[,2], coords[,3], c(x$bbox))
}

Try the SGCS package in your browser

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

SGCS documentation built on May 1, 2019, 8:20 p.m.