From 18669663b7f0c0a4df7354c0ea25e8ac704cc8c1 Mon Sep 17 00:00:00 2001 From: jrwishart Date: Sun, 5 Oct 2025 22:42:56 +1100 Subject: [PATCH] Untracked: Throw User error if user supplies non-positive cost parameter --- DESCRIPTION | 2 +- R/supportvectormachine.R | 6 ++++-- 2 files changed, 5 insertions(+), 3 deletions(-) diff --git a/DESCRIPTION b/DESCRIPTION index c1c9b6f..c66b8a7 100644 --- a/DESCRIPTION +++ b/DESCRIPTION @@ -1,7 +1,7 @@ Package: flipMultivariates Type: Package Title: Multivariate models -Version: 1.2.3 +Version: 1.2.4 Author: Displayr Maintainer: Displayr Description: Multivariate models (e.g. LDA, random forest, SVM) according to the flip Project conventions. diff --git a/R/supportvectormachine.R b/R/supportvectormachine.R index 06c9b6b..ba1af71 100644 --- a/R/supportvectormachine.R +++ b/R/supportvectormachine.R @@ -25,6 +25,7 @@ #' @param ... Other arguments to be supplied to \code{\link{svm}}. #' #' @importFrom e1071 svm +#' @importFrom flipU StopForUserError #' @export SupportVectorMachine <- function(formula, data = NULL, @@ -42,8 +43,9 @@ SupportVectorMachine <- function(formula, ##### Error checking specific to this function ###### #################################################################### - if (cost <= 0) - stop("cost must be positive but is ", cost) + if (cost <= 0) { + StopForUserError("cost must be positive but is ", cost) + } #################################################################### ##### Reading in the data and doing some basic tidying ######