Skip to content

Commit

Permalink
fixed bug where NA is already a level in a 1D table
Browse files Browse the repository at this point in the history
  • Loading branch information
DanChaltiel committed Apr 4, 2024
1 parent 1cf6f7c commit b988e73
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 1 deletion.
10 changes: 10 additions & 0 deletions NEWS.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,15 @@
Crosstables for descriptive analyses. See documentation at <https://danchaltiel.github.io/crosstable/> and browse code at <https://github.com/DanChaltiel/crosstable>.

# crosstable 0.7.1

#### New features

- xxxxx

#### Bug fixes and improvements

- Fixed a bug happening when NA is already a level in a 1D table

# crosstable 0.7.0 <sub><sup>2023-11-12</sup></sub>

#### New features
Expand Down
2 changes: 1 addition & 1 deletion R/cross_categorical.R
Original file line number Diff line number Diff line change
Expand Up @@ -71,7 +71,7 @@ summarize_categorical_single = function(x, showNA, total, digits, percent_patter
) %>%
getTableCI(digits=digits) %>%
mutate(across(starts_with("p_"), ~format_fixed(.x, digits=digits, percent=TRUE))) %>%
transmute(variable=replace_na(x, "NA"),
transmute(variable=x %>% str_replace("NA", "'NA'") %>% replace_na("NA"),
value=ifelse(is.na(x) | .data$n==0 & zero_percent,
.data$n, glue(percent_pattern$body)))

Expand Down

0 comments on commit b988e73

Please sign in to comment.