mirror of
https://github.com/msberends/AMR.git
synced 2024-12-26 20:06:11 +01:00
freq header fix for NAs
This commit is contained in:
parent
e4737d3add
commit
dec4947103
1
NEWS.md
1
NEWS.md
@ -25,6 +25,7 @@
|
|||||||
* Added header info for class `mo` to show unique count of families, genera and species
|
* 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")`
|
* 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
|
* 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)
|
# 0.5.0 (latest stable release)
|
||||||
|
2
R/freq.R
2
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), ' = ',
|
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) %>%
|
(NAs %>% length() / (NAs %>% length() + x %>% length())) %>% percent(force_zero = TRUE, round = digits, decimal.mark = decimal.mark) %>%
|
||||||
sub('NaN', '0', ., fixed = TRUE))
|
sub('NaN', '0', ., fixed = TRUE))
|
||||||
|
Loading…
Reference in New Issue
Block a user