From 72331965c9517c54ada17e32433de25cbea71d43 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Hansj=C3=B6rg=20Neth?= Date: Wed, 4 Sep 2024 10:46:56 +0200 Subject: [PATCH 1/3] bug fix: plot(heart.fft, main = NA) yielded an error (as n_char was NA, rather than 0). --- R/util_plot.R | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/R/util_plot.R b/R/util_plot.R index e4722fbe..259cd85d 100644 --- a/R/util_plot.R +++ b/R/util_plot.R @@ -422,7 +422,11 @@ get_x_dev <- function(string, csf = .80){ # csf: constant scaling factor # Returns a difference value that depends on string width (from min = .15 upwards). - n_char <- nchar(string) + if (!is.na(string)) { + n_char <- nchar(string) + } else { + n_char <- 0 + } if (n_char > 15){ # widen rectangle: From 73d412865d7ad508715983a8bfc626820a58892d Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Hansj=C3=B6rg=20Neth?= Date: Wed, 4 Sep 2024 11:04:06 +0200 Subject: [PATCH 2/3] Bug fix: Adjust row_lbl of 2x2 confusion matrix to read "Prediction" when using "test" data, but keep default of "Decision" otherwise. --- R/plotFFTrees_function.R | 15 +++++++++------ 1 file changed, 9 insertions(+), 6 deletions(-) diff --git a/R/plotFFTrees_function.R b/R/plotFFTrees_function.R index 8fe72957..4cec1f39 100644 --- a/R/plotFFTrees_function.R +++ b/R/plotFFTrees_function.R @@ -1640,7 +1640,7 @@ plot.FFTrees <- function(x = NULL, # print(lloc) # 4debugging - # Classification table: ---- + # Classification table: 2x2 matrix / confusion matrix: ---- if (show.confusion) { @@ -1695,16 +1695,19 @@ plot.FFTrees <- function(x = NULL, decision.labels[1], adj = 1 ) + # Adjust row category label: + if (data == "test") { + row_lbl <- "Prediction" + } else { # default: + row_lbl <- "Decision" + } + text( x = final_classtable_x[1] - .065, y = mean(final_classtable_y), cex = header_cex, - "Decision" + row_lbl ) - # text(x = final_classtable_x[1] - .05, - # y = mean(final_classtable_y), cex = header_cex, - # "Decision", srt = 90, pos = 3) - # Add final frequencies: ---- From d0615eb6b11719ef05fd8bc26e77d127906b1f01 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Hansj=C3=B6rg=20Neth?= Date: Wed, 4 Sep 2024 11:10:54 +0200 Subject: [PATCH 3/3] update NEWS --- NEWS.md | 11 ++++++++++- 1 file changed, 10 insertions(+), 1 deletion(-) diff --git a/NEWS.md b/NEWS.md index 24fce6a2..736b170a 100644 --- a/NEWS.md +++ b/NEWS.md @@ -15,13 +15,22 @@ From now on, consider using other packages such as **parsnip** or **tidymodels** ## Minor changes +Plotting: + +- `plot.FFTrees()` now labels row of 2x2 confusion matrix as "Prediction" when using "test" data. - `plot.FFTrees()` now has a `truth.labels` argument which, if set, distinguishes labels of true (signal vs. noise) cases from decision outcomes. - `plot.FFTrees()` now has a `grayscale` argument which, if TRUE, creates a grayscale plot. + + + +Decision costs: + - Increased value of `cost_cues_default` from 0 to 1, so that default cue costs correspond to `mcu`. ## Details +- Fix bug for missing plot title. - Added `@aliases FFTrees-package` to documentation of main `FFTrees()` function. - Removed redundant `data_old` folder. @@ -498,6 +507,6 @@ Thus, the main tree building function is now `FFTrees()` and the new tree object ------ -[File `NEWS.md` last updated on 2024-05-21.] +[File `NEWS.md` last updated on 2024-09-04.]