Description Usage Arguments Value Author(s) References Examples
View source: R/20_gadm_sf_core.R
read and import a file in shapefile format (.shp,.dbf,.proj) and put it in gadm_sf format for use with GADMTools
1 2  | 
dir | 
 Character path to the directory where .shp file is located (eg. “./”)  | 
name | 
 Character name of the .shp file without the extension (example: “india”)  | 
level | 
 Integer the administrative level  | 
del | 
 Character vector the variables (columns) to be deleted (optional if keepall == FALSE)  | 
renamed | 
 Character vector the variables to be renamed (eg. the administrative fields in GADM are named NAME_X where X is the level, and the ISO code(3))  | 
keepall | 
 Boolean if FALSE (default), allows to keep only the columns useful for GADMTools  | 
Object of class gadm_sf (Simple Features wrapper)
Jean Pierre Decorps <jp.decorps@epiconcept.fr>
—-
1 2 3 4 5 6 7 8 9 10 11  | # library(GADMTools)
# map <- gadm_sf_import_shp(dir="./", name = "india", level = 2,
#                           del = c("DCODE", "NAME3", "SDCODE"),
#                           renamed = c(’ISO’ = ’COUNTRY’,
#                                       ’NAME_0’ = ’COUNTRY_LO’,
#                                       ’NAME_1’ = ’NAME1’,
#                                       ’NAME_2’ = ’NAME2’),
#                           keepall = FALSE
#                          )
# map$sf$ISO <- "IND"
# map$sf$NAME_0 <- "India"
 | 
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.