mutate_jenks_brks: Generate Jenks Breaks for Mapping with ggplot2

Description Usage Arguments Value Warning Examples

Description

This function is a wrapper around the 'dplyr' 'mutate()' function that generates Jenks breaks using the 'classIntervals' package. See classIntervals for more details on methods.

Usage

1
mutate_jenks_brks(input, variable, ...)

Arguments

input

a 'data.frame' or 'spatial' object

variable

name (using standard evaluation) a continuous variable either 'integer' or 'numeric' to apply Jenks breaks

...

arguments used in 'classIntervals' specific to 'style = "jenks"'

Value

returns the 'input' object with a new 'factor' columns named as 'variable_brks' that contains Jenks breaks and corresponding labels for each 'factor' level

Warning

The Jenks breaks do not like missing values and will give a warning message when the variable of interest contains missing values!

Examples

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
#Apply Jenks breaks on the Solar Radiation column frmo the airqualtiy dataset
airquality %>% mutate_jenks_brks(Solar.R)

## Not run: 
# Ebola Cause of Death joined to Chiefdom Shapefiles
# create Jenks breaks for deaths with 6 breaks

evd_shp <- evd_shp %>% mutate_jenks_brks(deaths, n = 6)

p_evd_deaths <- ggplot(evd_shp) + geom_sf(aes(fill=deaths_brks)) +
scale_fill_brewer(type = "seq", palette = 9, name = "Deaths") +
theme_void() 

## End(Not run)

smh-ej/XploreR documentation built on May 13, 2019, 4:46 p.m.