CRAN_Status_Badge Research software impact Build Status

recmap - Compute the Rectangular Statistical Cartogram

This package implements the RecMap construction algorithm (MP2) using the GA CRAN package as metaheuristic.

1. Installation

use CRAN

recmap requires R 3.5 or later.

Released and tested versions of recmap are available via CRAN, and can be installed using the following code

install.packages('recmap')

2. Documentation

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.

3. Demonstration

Run an interactive shiny application

# Requires to install suggested  packages
pkgs <- c('colorspace', 'maps', 'noncensus', 'shiny')
pkgs <- pkgs[(!pkgs %in% unique(installed.packages()[,'Package']))]
if(length(pkgs) > 0){install.packages(pkgs)}

library(shiny)
recmap_shiny <- system.file('shiny-examples', package = 'recmap')
shiny::runApp(recmap_shiny, display.mode = 'normal')

Run the recmap shiny demonstration as a stand-alone application using Linux and Apple systems use the Terminal application 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. (Frequently) Asked Questions

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.