remove_var: Removes variable(s) from a Spatial*DataFrame

Description Usage Arguments Value Examples

View source: R/remove_var.R

Description

Removes variable(s) from a Spatial*DataFrame

Usage

1
remove_var(spdf, var = NULL)

Arguments

spdf

A Spatial*DataFrame object

var

A vector of variable names or indexes to remove.

Value

An object of the same class as spdf.

Examples

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
# An example with a SpatialPointsDataFrame object:
# devtools::install_github("epix-project/imhen")
library(sf)
stations <- as(imhen::stations, "Spatial")
stations
remove_var(stations, "elevation")
remove_var(stations, 2)
remove_var(stations)

# An example with a SpatialPoints object:
# download vietnam admin1 administrative map in the internal library and in
# the working direction
vn <- sptools::gadm("vietnam", "sp", 1, intlib = TRUE, save = TRUE)
vn
remove_var(vn, c(6, 9))

choisy/sptools documentation built on Aug. 22, 2019, 12:57 p.m.