From 2ac16cb4b56b773dd1b4583de683a26b3579cead Mon Sep 17 00:00:00 2001 From: Jari Oksanen Date: Sun, 30 Jun 2024 17:55:00 +0300 Subject: [PATCH] decorana: require and check that data are numeric character data (or vector code) starting with " " is regarded < 0, and give error of negative data. This can be behind the confusion in https://stackoverflow.com/questions/78666646/ --- R/decorana.R | 2 ++ 1 file changed, 2 insertions(+) diff --git a/R/decorana.R b/R/decorana.R index 41dda9757..ec0f52d75 100644 --- a/R/decorana.R +++ b/R/decorana.R @@ -8,6 +8,8 @@ ZEROEIG <- 1e-7 # same limit as in the C function do_decorana ## data veg <- as.matrix(veg) + if (!is.numeric(veg)) + stop("data must be numeric (no factors nor characters)") if (any(veg < 0)) stop("'decorana' cannot handle negative data entries") ## optional data transformation