https://github.com/cran/spatstat
Revision 18acf14110bc4241dc61b67f2572e8de8ec4ff33 authored by Adrian Baddeley on 14 May 2008, 23:29:29 UTC, committed by cran-robot on 14 May 2008, 23:29:29 UTC
1 parent 845d2bb
Raw File
Tip revision: 18acf14110bc4241dc61b67f2572e8de8ec4ff33 authored by Adrian Baddeley on 14 May 2008, 23:29:29 UTC
version 1.13-2
Tip revision: 18acf14
rescale.R
#
#
#   rescale.R
#
#   $Revision: 1.3 $ $Date: 2007/10/24 09:41:15 $
#
#

rescale <- function(X, s) {
  UseMethod("rescale")
}

rescale.ppp <- function(X, s) {
  Y <- affine.ppp(X, mat=diag(c(1/s,1/s)))
  unitname(Y) <- rescale(unitname(X), s)
  return(Y)
}

rescale.owin <- function(X, s) {
  Y <- affine.owin(X, mat=diag(c(1/s,1/s)))
  unitname(Y) <- rescale(unitname(X), s)
  return(Y)
}

rescale.psp <- function(X, s) {
  Y <- affine.psp(X, mat=diag(c(1/s,1/s)))
  unitname(Y) <- rescale(unitname(X), s)
  return(Y)
}
  
rescale.units <- function(X, s) {
  if(summary(X)$vanilla)
    return(X)
  if(!is.numeric(s) || length(s) != 1 || s <= 0)
    stop("s should be a positive number")
  X$multiplier <- s * X$multiplier
  return(X)
}


back to top