From 3dae89282d9b2b097813a039524a966124f31381 Mon Sep 17 00:00:00 2001 From: Holger Brandl Date: Fri, 19 Jan 2018 10:26:44 +0100 Subject: [PATCH] added round_any --- R/core_commons.R | 3 +++ 1 file changed, 3 insertions(+) diff --git a/R/core_commons.R b/R/core_commons.R index e869dd3..70bbbba 100644 --- a/R/core_commons.R +++ b/R/core_commons.R @@ -545,6 +545,9 @@ trim_outliers <- function(values, probs=c(0.05, 0.95)){ se <- function(x) sd(x, na.rm = TRUE) / sqrt(sum(! is.na(x))) +# https://stackoverflow.com/questions/43627679/round-any-equivalent-for-dplyr/46489816#46489816 +round_any = function(x, accuracy, f=round){f(x/ accuracy) * accuracy} + ######################################################################################################################## ### Misc -- GitLab