Install cartogramR from CRAN with:
install.packages("cartogramR")
For windows users, the CRAN distributes a compiled package and there is no need to install it from source. If you install package from sources, you will need FFTW. This library is fairly common thus a package for it is usually available (linux: see fftw-devel (rpm), fftw-dev (deb); Mac OS X: fftw (brew)).
For example cartogram for the number of electors in the USA in 1964: 1. Load package, data and verify that at least one grid point fall in each region (the smallest region is Washington DC)
r
library(cartogramR)
data(usa)
plot(precartogramR(usa))
2. The default grid size $L=512$ is OK, thus we can run the cartogram for
variable electors64
and plot the cartogram:
r
carto <- cartogramR(usa, "electors64")
plot(carto)
Any scripts or data that you put into this service are public.
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.