diff --git a/NEWS.md b/NEWS.md index 0e2d7d7c..f304ac52 100755 --- a/NEWS.md +++ b/NEWS.md @@ -25,6 +25,7 @@ * Added header info for class `mo` to show unique count of families, genera and species * Now honours the `decimal.mark` setting, which just like `format` defaults to `getOption("OutDec")` * The new `big.mark` parameter will at default be `","` when `decimal.mark = "."` and `"."` otherwise + * Fix for header text where all observations are `NA` # 0.5.0 (latest stable release) diff --git a/R/freq.R b/R/freq.R index b879c5ca..418a1ffd 100755 --- a/R/freq.R +++ b/R/freq.R @@ -316,7 +316,7 @@ frequency_tbl <- function(x, } } - if (NROW(x) > 0) { + if ((length(NAs) + length(x) > 0) > 0) { na_txt <- paste0(NAs %>% length() %>% format(decimal.mark = decimal.mark, big.mark = big.mark), ' = ', (NAs %>% length() / (NAs %>% length() + x %>% length())) %>% percent(force_zero = TRUE, round = digits, decimal.mark = decimal.mark) %>% sub('NaN', '0', ., fixed = TRUE))