This package implements the RecMap construction algorithm (MP2) using the GA CRAN package as a metaheuristic.
use CRAN
recmap requires R 3.6 or later.
Released and tested versions of recmap are available via CRAN, and can be installed using the following code
install.packages('recmap') before running, R CMD build and R CMD check or running the shiny demo execute
pkgs <- c('colorspace', 'doParallel', 'DT', 'knitr', 'maps', 'shiny', 'testthat', 'tufte') pkgs <- pkgs[(!pkgs %in% unique(installed.packages()[,'Package']))] if(length(pkgs) > 0){install.packages(pkgs)} The package ships with a package vignette (browseVignettes('recmap')) and a reference manual (just type ?recmap on the R shell). Both documents are also available on the package's CRAN page. A white paper containing more technical information and examples is available through jss.v086.c01.
Run an interactive shiny application
library(recmap) GA::gaControl("useRcpp" = FALSE) # apple M1 recmap_shiny <- system.file('shiny-examples', package = 'recmap') shiny::runApp(recmap_shiny, display.mode = 'normal') To run the recmap shiny demonstration as a stand-alone application on Linux and macOS systems, use the Terminal application and add the following code to your alias file, e.g., $HOME/.bashrc
alias recmapShiny="R -e \"library(shiny); \ recmap_shiny <- system.file('shiny-examples', package = 'recmap'); \ shiny::runApp(recmap_shiny, display.mode = 'normal', launch.browser=TRUE)\"" execute
. $HOME/.bashrc && recmapShiny
4.1 Is there an easy way to convert a recmap object to an sf object?
Use as.SpatialPolygonsDataFrame, see also issue #13. The as.recmap function performs the transformation from a SpatialPolygonsDataFrame into a recmap compatible object.
- Rectangular Cartograms: the game, Rectangular Cartograms
- cartogram: Create Cartograms with R https://CRAN.R-project.org/package=cartogram
- Rcartogram
- High-performance software to produce flow-based cartograms.
- see also CRAN Task View: Analysis of Spatial Data
- Computing Stable Demers Cartograms - https://arxiv.org/abs/1908.07291
- Wang, L., Yuan, H., Li, X., Lu, P., & Li, Y. (2025). A New Construction Method for Rectangular Cartograms. ISPRS International Journal of Geo-Information, 14(1), 25. doi 10.3390/ijgi14010025
