Learn R Programming

GADMTools (version 3.9-1)

json.choropleth: Create a geojson choropleth of selected regions.

Description

Drawing a choropleth (colored regions based on data values) with GADMTools is straightforward. You just have to select your shape(s) file(s) with gadm_loadcountries, load your data from a csv file for example, and call the json.choropleth function with the right arguments. json.choropleth creaate a GEOJSON file (output.json) that can be used with Leaflet library.

Usage

json.choropleth (x, data, value=NULL, breaks = NULL, steps = 5,
  adm.join=NULL, legend = NULL, labels = NULL, palette=NULL,
  title="")

Arguments

x

Object gadm_sp

data

data.frame - data to plot

value

String - the name of the column in the data.frame we want to plot (eg: an incidence in epidemiology studies)

breaks

steps

Integer - number of breaks. Default = 5. If breaks is NOT NULL this value is used internally with cut().

adm.join

String - the name in GADM spdf dataset which will be joined with a column of the data.

legend

String - legend title. Default NULL.

labels

String vector labels for the legend. Default NULL

palette

String - An RColorBrewer palette name or a String vector vector of colors. Default NULL.

title

String - Title of the plot. Default is an empty string.

Value

Object a lattice plot of class "trellis"

Details

----

References

----

See Also

classIntervals

Examples

Run this code
# NOT RUN {
##---- Should be DIRECTLY executable !! ----
##-- ==>  Define data, use random,
##--	or do  help(data=index)  for the standard data sets.
# }

Run the code above in your browser using DataLab