freq header fix for NAs

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

No files matched your search

+1 -1
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))