R/plotting-options.R

# Generated by autofun (0.0.0.9000): do not edit by hand!!!
# Please edit source code in R-autofun/plotting-options.R
.plotting_options<-function(...){
expression(if (plotit) {
  par0 <- par()
  on.exit(suppressWarnings(par(par0)))
  if (missing(boundary)) {
    x <- by(candi[, 1], as.factor(candi[, 2]), FUN = range, simplify = FALSE)
    x <- do.call(rbind, x)
    d <- dist(x)
    d <- min(d[d > 0]) / 2
    x[, 1] <- x[, 1] - d
    x[, 2] <- x[, 2] + d
    y <- as.numeric(rownames(x))
    xy <- cbind(c(x[, 1], x[, 2]), rep(y, 2))
    
    y <- by(candi[, 2], as.factor(candi[, 1]), FUN = range, simplify = FALSE)
    y <- do.call(rbind, y)
    d <- dist(y)
    d <- min(d[d > 0]) / 2
    y[, 1] <- y[, 1] - d
    y[, 2] <- y[, 2] + d
    x <- as.numeric(rownames(y))
    yx <- cbind(rep(x, 2), c(y[, 1], y[, 2]))
    
    boundary <- unique(rbind(xy, yx))
    rownames(boundary) <- 1:nrow(boundary)
    boundary <- sp::SpatialPoints(boundary)
    
    rm(x, d, y, xy, yx)
  }
  # I guess this was the reason for the warning message seen by Alexandre Wadoux.
  # It seems that 'rm' should be inside 'if (missing(boundary)) {...}', not outside!!!
  # rm(x, d, y, xy, yx)
  
  # Open two new plotting devices
  grDevices::dev.new()
  grDevices::dev.new()
})
}

Try the spsann package in your browser

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

spsann documentation built on May 2, 2019, 1:36 p.m.