Learn R Programming

recmap (version 1.0.9)

as.recmap.SpatialPolygonsDataFrame: Convert a SpatialPolygonsDataFrame Object to recmap Object

Description

The method generates a recmap class out of a SpatialPolygonsDataFrame object.

Usage

# S3 method for SpatialPolygonsDataFrame
as.recmap(X)

Arguments

Value

returns a recmap object.

References

Roger S. Bivand, Edzer Pebesma, Virgilio Gomez-Rubio, 2013. Applied spatial data analysis with R, Second edition. Springer, NY. https://asdar-book.org/

See Also

Examples

Run this code
# NOT RUN {
  SpDf <- as.SpatialPolygonsDataFrame(recmap(checkerboard(8)))

  summary(SpDf)
  spplot(SpDf)

  summary(as.recmap(SpDf))



  # taken from https://github.com/sjewo/cartogram
	
	
# }
# NOT RUN {
     if (requireNamespace("maptools", quietly = TRUE)) {
	library(maptools)
        data(wrld_simpl)

	afr <- as.recmap(wrld_simpl[wrld_simpl$REGION==2, ])
	is.recmap(afr)

	afr$z <- afr$POP2005 

	is.recmap(afr)
	afr <- afr[afr$z > 0, ]

	# make map overlap to generate a connected pseudo dual
	afr$dx <- 2.0 * afr$dx
	afr$dy <- 2.0 * afr$dy


	# overview
	plot(recmap(afr))

	# use the GA
	set.seed(1)
	plot(recmapGA(afr))

     }
	
# }

Run the code above in your browser using DataLab