Description Usage Arguments Details Value Examples
This function selects the class intervals for a numeric column in a data frame.
1 2 |
df |
a data frame containing at least one numeric column |
col_name |
name of the column containing the value on which the class intervals should be calculate |
n |
a numeric indicating the number of intervals to represent the data
(by default, |
style |
a character value issued from the |
pal |
the color for the distribution legend, by default |
fixedBreaks |
By default |
distribution |
if TRUE, print on the map, the distribution of the values by intervals |
For more information on the parameter style
, please, look at
the package classint
.
The data frame inputed with attributes breaks
corresponding to
the breaks value, returned invisibly.
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 | # Example with data preparation
library(gdpm)
library(dplyr)
dengue <- getid(dengue, from = 1990, to = 1991)
dengue_prep <- filter(dengue, year == 1990, month == "September")
a <- breaks(dengue_prep, "incidence_dengue")
str(a)
# to extract the breaks value
attr(a, "breaks")
# to print the distribution
breaks(dengue_prep, "incidence_dengue", pal = heat.colors(6),
distribution = TRUE)
# to change the style or number of breaks
breaks(dengue_prep, "incidence_dengue", n = 8, style = "fisher")
breaks(dengue_prep, "incidence_dengue", n = 8, style = "fisher",
pal = heat.colors(8), distribution = TRUE)
# to use the "fixed" style
breaks(dengue_prep, "incidence_dengue", n = 6, style = "fixed",
fixedBreaks = c(0, 50, 100, 500, 1000, 1500, 2000))
breaks(dengue_prep, "incidence_dengue", n = 6, style = "fixed",
pal = heat.colors(6), distribution = TRUE,
fixedBreaks = c(0, 50, 100, 500, 1000, 1500, 2000))
|
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.