The structure of objects of classes defined in the sp package

The following makes use of the cshapes and sp package. You may need to install the sp package from CRAN using the code install.packages("sp") if you want to run this on your computer. Since version 2.0 of the cshape package, the code below no longer works, so you will need to install version 0.6 from https://cran.r-project.org/src/contrib/Archive/cshapes/cshapes_0.6.tar.gz, using the code install.packages("https://cran.r-project.org/src/contrib/Archive/cshapes/cshapes_0.6.tar.gz",repos=NULL). As this version of cshapes also depends on the package plyr you may need to install this package using install.packages("plyr").

library(cshapes)
Loading required package: sp
Loading required package: maptools
Checking rgeos availability: TRUE
Please note that 'maptools' will be retired by the end of 2023,
plan transition at your earliest convenience;
some functionality will be moved to 'sp'.
Loading required package: plyr
cshape.sp <- cshp()
Warning:
readShapePoly is deprecated; use rgdal::readOGR or sf::st_read
# Obtaining the data for the Gambia from the Cshapes data base
Gambia <- subset(cshape.sp,CNTRY_NAME=="The Gambia")
plot(Gambia)
spatial-datastructures-sp_5_0.png
class(Gambia)
[1] "SpatialPolygonsDataFrame"
attr(,"package")
[1] "sp"