View source: R/cut_to_classes.R
cut_to_classes | R Documentation |
Categorises a numeric vector into automatic or manually defined
categories and polishes the labels ready for used in mapping with ggplot2
.
cut_to_classes(
x,
n = 5,
style = "equal",
manual = FALSE,
manual_breaks = NULL,
decimals = 0,
nodata_label = "No data"
)
x |
A numeric vector, eg. |
n |
A numeric. number of classes/categories |
style |
chosen style: one of "fixed", "sd", "equal", "pretty", "quantile", "kmeans", "hclust", "bclust", "fisher", "jenks", "dpih", "headtails", "maximum", or "box" |
manual |
Logical. If manual breaks are being used |
manual_breaks |
Numeric vector with manual threshold values |
decimals |
Number of decimals to include with labels |
nodata_label |
String. Text label for NA category. |
a factor.
Markus Kainu markuskainu@gmail.com
classInt::classIntervals()
Other helpers:
dic_order()
,
eurotime2date()
,
eurotime2num()
,
harmonize_country_code()
,
label_eurostat()
# lp <- get_eurostat("nama_aux_lp")
lp <- get_eurostat("nama_10_lp_ulc")
lp$class <- cut_to_classes(lp$values, n = 5, style = "equal", decimals = 1)
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.