These functions split cell values by quantiles. Non-numeric cells are ignored.
by_quantiles( quantiles, values, right = FALSE, extend = TRUE, ignore_na = TRUE, colwise = FALSE ) by_equal_groups(n, values, ignore_na = TRUE, colwise = FALSE)
quantiles | Vector of quantiles. |
---|---|
values | Vector of values. |
right | If |
extend | Extend |
ignore_na | If |
colwise | Logical. Calculate breaks separately within each column? |
n | Number of equal-sized groups. |
A function for use in map_***
functions.
by_equal_groups(n, values)
splits the data into n
equal-sized groups (i.e. it is a shortcut
for by_quantiles(seq(1/n, 1 - 1/n, 1/n), values)
).
Other mapping functions:
by_cases()
,
by_colorspace()
,
by_function()
,
by_ranges()
,
by_regex()
,
by_rows()
,
by_values()
ht <- hux(rnorm(5), rnorm(5)) map_background_color(ht, by_quantiles( c(0.2, 0.8), c("red", "yellow", "green") ))#> -0.702 0.437 #> 0.973 0.413 #> -0.0768 0.976 #> 0.893 1.15 #> -0.778 1.22 #> #> Column names: c(-0.702081978036061, 0.973315776961382, -0.0768176526331006, , #> c(0.436797105633089, 0.413443934826962, 0.976341772031728, 1.14650049897401,#> -0.702 0.437 #> 0.973 0.413 #> -0.0768 0.976 #> 0.893 1.15 #> -0.778 1.22 #> #> Column names: c(-0.702081978036061, 0.973315776961382, -0.0768176526331006, , #> c(0.436797105633089, 0.413443934826962, 0.976341772031728, 1.14650049897401,#> -0.702 0.437 #> 0.973 0.413 #> -0.0768 0.976 #> 0.893 1.15 #> -0.778 1.22 #> #> Column names: c(-0.702081978036061, 0.973315776961382, -0.0768176526331006, , #> c(0.436797105633089, 0.413443934826962, 0.976341772031728, 1.14650049897401,