From d1c2b7e55fd8cf1c0d1911306b04520aa994f476 Mon Sep 17 00:00:00 2001 From: Nicolas Casajus Date: Tue, 30 Apr 2024 10:59:56 +0200 Subject: [PATCH] fix: check for numerical metric --- R/ggmap_marine.R | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/R/ggmap_marine.R b/R/ggmap_marine.R index a501486..c4dd471 100644 --- a/R/ggmap_marine.R +++ b/R/ggmap_marine.R @@ -71,6 +71,11 @@ ggmap_marine <- function(data, metric, title = NULL, error_if_field_not_in_df(data, metric) + if (!is.numeric(data[ , metric, drop = TRUE])) { + stop("The column '", metric, "' in 'data' must be `numeric`", + call. = FALSE) + } + if (!is.null(title)) { error_if_not_character(title) error_if_not_length_of(title, 1)