R/prepro.R

prepro <- function (X, method = 'bn')
{
  
  method <- match.arg (method, c('bn', 'msc'), several.ok = TRUE) # more2come ..
  
  if ('bn' %in% method)
  {
    if (is.vector (X)) X <- X / sqrt (sum (X ^ 2))
    if (is.matrix (X)) X <- X / sqrt (rowSums (X ^ 2))         
    if (class (X) == 'RasterBrick' || class (X) == 'RasterStack')
      X <- X / sqrt (raster::stackApply (X ^ 2, rep (1, raster::nlayers (X)), sum))
  }
  invisible (X)
}

Try the autopls package in your browser

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

autopls documentation built on May 2, 2019, 9:39 a.m.