Skip to content

Commit 3cbe421

Browse files
committed
Improve check and warning message in plot_AbanicoPlot().
1 parent d2f64ce commit 3cbe421

File tree

2 files changed

+3
-3
lines changed

2 files changed

+3
-3
lines changed

R/plot_AbanicoPlot.R

+2-2
Original file line numberDiff line numberDiff line change
@@ -673,9 +673,9 @@ plot_AbanicoPlot <- function(
673673
bw.test <- try(density(x = data[[i]][,1],
674674
bw = bw),
675675
silent = TRUE)
676-
if(grepl(pattern = "Error", x = bw.test[1]) == TRUE) {
676+
if (inherits(bw.test, "try-error")) {
677677
bw <- "nrd0"
678-
.throw_warning("Option for bw not possible. Set to nrd0!")
678+
.throw_warning("Option for 'bw' not valid, reset to 'nrd0'")
679679
}
680680
}
681681

tests/testthat/test_plot_AbanicoPlot.R

+1-1
Original file line numberDiff line numberDiff line change
@@ -259,7 +259,7 @@ test_that("more coverage", {
259259
## further edge tests ... check for wrong bw parameter
260260
expect_warning(
261261
object = plot_AbanicoPlot(data = ExampleData.DeValues, bw = "tests"),
262-
regexp = "Option for bw not possible. Set to nrd0!")
262+
regexp = "Option for 'bw' not valid, reset to 'nrd0'")
263263

264264
## negative values
265265
df <- ExampleData.DeValues

0 commit comments

Comments
 (0)