I am trying to make a switch to the "new" tidyverse
ecosystem and try to avoid loading the old packages from Wickham et al. I used to rely my coding previously. I found round_any
function from plyr useful in many cases where I needed custom rounding for plots, tables, etc. E.g.
x <- c(1.1, 1.0, 0.99, 0.1, 0.01, 0.001)
library(plyr)
round_any(x, 0.1, floor)
# [1] 1.1 1.0 0.9 0.1 0.0 0.0
Is there an equivalent for round_any
function from plyr package in tidyverse
?
floor(x / 0.1) * 0.1
. To avoid loading the package, use the::
notation:plyr::round_any
. – Florieggplot2::cut_width
. See github.com/tidyverse/ggplot2/releases/tag/v2.0.0 – Pengelly