insightsengineering / insightsengineering/goshawk

investigate `facet_var` specification in `g_boxplot.R`

Open
#200 1 comment 0 reactions 0 assignees View on GitHub
core sme
Dominant language
R
Stars
5
Forks
1
PR merge metrics
No merged PRs in 30d

Description

https://github.com/insightsengineering/goshawk/blob/531047c9f2134e4c780a0c19912f68b24f950cf0/R/g_boxplot.R#L265

`facet_var` defaults to `NULL` for no faceting but can also be set to "None" for no faceting. This seems redundant. Investigate whether the "None" case can be discarded and simplify accordingly.

```
# Add facetting.
if (!is.null(facet_var)) {
if (facet_var != "None" & facet_var %in% names(data)) {
if (!is_finite(facet_ncol)) facet_ncol <- 0
if (facet_ncol >= 1) {
plot1 <- plot1 +
ggplot2::facet_wrap(stats::as.formula(paste0(" ~ ", facet_var)), ncol = round(facet_ncol))
} else {
plot1 <- plot1 +
ggplot2::facet_wrap(stats::as.formula(paste0(" ~ ", facet_var)))
}
}
}
```

Contributor guide

Open the contributing guide

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.