R/points2shape.R

Defines functions points2shape

Documented in points2shape

points2shape <-
function (dat, x, y, fn) 
{
    cn <- names(dat)
    f1 <- match(x, cn)
    f2 <- match(y, cn)
    xn <- coord2numeric(dat[, f1])
    yn <- coord2numeric(dat[, f2])
    coords <- cbind(xn, yn)
    data <- as.data.frame(dat)
    z1 <- SpatialPointsDataFrame(coords, data, bbox = bbox(coords), 
        proj4string = CRS("+proj=longlat +datum=WGS84"))
    writePointsShape(z1, fn)
}

Try the biogeo package in your browser

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

biogeo documentation built on May 29, 2017, 10:55 a.m.