1
0
mirror of https://github.com/msberends/AMR.git synced 2024-12-25 19:26:13 +01:00

freq header fix for NAs

This commit is contained in:
dr. M.S. (Matthijs) Berends 2018-12-14 10:08:51 +01:00
parent e4737d3add
commit dec4947103
2 changed files with 2 additions and 1 deletions

View File

@ -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)

View File

@ -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))