Description Usage Arguments Value Examples
Adds variable(s) to a Spatial*DataFrame
1 | add_variable_spdf(spdf, df)
|
spdf |
A Spatial*DataFrame object |
df |
A vector or a data frame |
An object of the same class than sp
.
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 | # 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
vn <- add_variable_spdf(vn, rnorm(63))
vn
# The name of the new variable will be "df". To prevent that we could choose
# the data frame format:
vn <- add_variable_spdf(vn, data.frame(normal = rnorm(63)))
vn
# The data frame format allows the additional possibility to add several
# additional variables all at once:
vn <- add_variable_spdf(vn,
data.frame(uniform = runif(63), exponential = rexp(63)))
vn
|
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.