From 36f85e929c7b62df1cbb7400e02e47115f597a62 Mon Sep 17 00:00:00 2001 From: Daniel Date: Sun, 19 Jan 2025 17:50:48 +0100 Subject: [PATCH] Remove the internal utility `.to_numeric()`? (#358) Fixes #206 --- R/estimate_grouplevel.R | 2 +- R/utils.R | 10 ---------- 2 files changed, 1 insertion(+), 11 deletions(-) diff --git a/R/estimate_grouplevel.R b/R/estimate_grouplevel.R index 15dc00e4d..f0a5038c5 100644 --- a/R/estimate_grouplevel.R +++ b/R/estimate_grouplevel.R @@ -80,7 +80,7 @@ estimate_grouplevel <- function(model, type = "random", ...) { random <- random[c("Group", "Level", names(random)[!names(random) %in% c("Group", "Level")])] # Sort - random <- random[order(random$Group, .to_numeric(random$Level), random$Parameter), ] + random <- random[order(random$Group, datawizard::coerce_to_numeric(random$Level), random$Parameter), ] # Clean row.names(random) <- NULL diff --git a/R/utils.R b/R/utils.R index 7a6af01c9..f8dc9282f 100644 --- a/R/utils.R +++ b/R/utils.R @@ -1,13 +1,3 @@ -#' @keywords internal -#' @noRd -.to_numeric <- function(x) { - tryCatch(as.numeric(as.character(x)), - error = function(e) x, - warning = function(w) x - ) -} - - #' @keywords internal #' @noRd .brms_aux_elements <- function() {