Skip to content

Commit

Permalink
test if less or equal is handle
Browse files Browse the repository at this point in the history
fix #49
  • Loading branch information
larmarange committed Nov 20, 2023
1 parent 1788587 commit b4e1d79
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 1 deletion.
5 changes: 5 additions & 0 deletions NEWS.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,10 @@
# ggstats (development version)

**Bug fixes**

* fix in `ggcoef_model()` and other similar functions when Unicode character
'less or equal' is not handle by the system

# ggstats 0.5.0

**Improvements**
Expand Down
8 changes: 7 additions & 1 deletion R/ggcoef_model.R
Original file line number Diff line number Diff line change
Expand Up @@ -1152,7 +1152,13 @@ ggcoef_data <- function(

if (!is.null(significance)) {
if (is.null(significance_labels)) {
significance_labels <- paste(c("p \u2264", "p >"), significance)
# test if \u2264 could be safely used
test_unicode <- purrr::quietly(function() {plot(0, main = "\u2264")})

Check warning on line 1156 in R/ggcoef_model.R

View workflow job for this annotation

GitHub Actions / lint

file=R/ggcoef_model.R,line=1156,col=49,[brace_linter] Opening curly braces should never go on their own line and should always be followed by a new line.
if (length(test_unicode()$warnings) == 0) {
significance_labels <- paste(c("p \u2264", "p >"), significance)
} else {
significance_labels <- paste(c("p <=", "p >"), significance)
}
}
data$significance <- factor(
!is.na(data$p.value) & data$p.value <= significance,
Expand Down

0 comments on commit b4e1d79

Please sign in to comment.