From 1ff499af8cd9e02729942096f099a8300e98eba2 Mon Sep 17 00:00:00 2001 From: Michael Hahsler Date: Tue, 25 Jun 2024 17:19:08 -0500 Subject: [PATCH] better check if pmml is installed. --- R/pmml.R | 5 +---- man/pmml.Rd | 5 ++--- 2 files changed, 3 insertions(+), 7 deletions(-) diff --git a/R/pmml.R b/R/pmml.R index baa6966..96d1130 100644 --- a/R/pmml.R +++ b/R/pmml.R @@ -34,9 +34,7 @@ #' @references PMML 4.4 - Association Rules. #' \url{https://dmg.org/pmml/v4-4/AssociationRules.html} #' @keywords interface -#' @examples -#' ### only run this example if pmml is installed -#' if("pmml" %in% rownames(installed.packages())) { +#' @examplesIf requireNamespace("pmml", quietly = TRUE) #' data("Groceries") #' #' rules <- apriori(Groceries, parameter = list(support = 0.001)) @@ -56,7 +54,6 @@ #' #' ### clean up #' unlink("rules.xml") -#' } NULL #' @rdname pmml diff --git a/man/pmml.Rd b/man/pmml.Rd index 94e089a..ebb302d 100644 --- a/man/pmml.Rd +++ b/man/pmml.Rd @@ -21,8 +21,7 @@ This function reads and writes PMML representations (version 4.1) of \link{associations} (\link{itemsets} and \link{rules}). Write delegates to package \pkg{pmml}. } \examples{ -### only run this example if pmml is installed -if("pmml" \%in\% rownames(installed.packages())) { +\dontshow{if (requireNamespace("pmml", quietly = TRUE)) (if (getRversion() >= "3.4") withAutoprint else force)(\{ # examplesIf} data("Groceries") rules <- apriori(Groceries, parameter = list(support = 0.001)) @@ -42,7 +41,7 @@ inspect(rules2[1]) ### clean up unlink("rules.xml") -} +\dontshow{\}) # examplesIf} } \references{ PMML 4.4 - Association Rules.