gadm_sf_import_shp: read and import a file in shapefile format

Description Usage Arguments Value Author(s) References Examples

View source: R/20_gadm_sf_core.R

Description

read and import a file in shapefile format (.shp,.dbf,.proj) and put it in gadm_sf format for use with GADMTools

Usage

1
2
  gadm_sf_import_shp(dir, name, level, del = NULL, 
                     renamed = NULL, keepall = FALSE)

Arguments

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

Value

Object of class gadm_sf (Simple Features wrapper)

Author(s)

Jean Pierre Decorps <jp.decorps@epiconcept.fr>

References

—-

Examples

 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"

GADMTools documentation built on Aug. 5, 2021, 1:06 a.m.