R/sp_bbox.R

sp_bbox = function (obj) 
{
    is_points <- function(obj) {
        is <- FALSE
        if (is.array(obj)) 
            if (length(dim(obj)) == 2) 
                if (dim(obj)[2] >= 2) 
                  is <- TRUE
        is
    }
    if (!is_points(obj)) 
        stop("object not a >= 2-column array")
    xr <- range(obj[, 1], na.rm = TRUE)
    yr <- range(obj[, 2], na.rm = TRUE)
    res <- rbind(x = xr, y = yr)
    colnames(res) <- c("min", "max")
    res
}

Try the RgoogleMaps package in your browser

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

RgoogleMaps documentation built on Nov. 6, 2023, 5:08 p.m.