From abe52f193a71403dcb3e6e71b2f89d215652c5f0 Mon Sep 17 00:00:00 2001 From: Johannes Ranke Date: Thu, 5 Mar 2026 15:47:24 +0100 Subject: Don't run examples per default This is because PubChem and BCPC could be unavailable, e.g. on R-Universe or CRAN. --- R/chent.R | 9 +++++++++ man/chent.Rd | 3 +++ man/pai.Rd | 3 +++ man/plot.chent.Rd | 3 +++ 4 files changed, 18 insertions(+) diff --git a/R/chent.R b/R/chent.R index 038fe7b..5302ef9 100644 --- a/R/chent.R +++ b/R/chent.R @@ -40,6 +40,8 @@ #' @param file The file to write to #' @param dir The directory to write the file to #' @examples +#' # Don't run examples per default, as PubChem may be unavailable +#' \dontrun{ #' caffeine <- chent$new("caffeine") #' print(caffeine) #' if (!is.null(caffeine$Picture)) { @@ -47,6 +49,7 @@ #' } #' oct <- chent$new("1-octanol", smiles = "CCCCCCCCO", pubchem = FALSE) #' print(oct) +#' } chent <- R6Class("chent", public = list( #' @field identifier (`character(1)`)\cr @@ -630,11 +633,14 @@ draw_svg.chent = function(x, width = 300, height = 150, #' @param ... Further arguments passed to [grImport::grid.picture] #' @export #' @examples +#' # Don't run examples per default, as PubChem may be unavailable +#' \dontrun{ #' caffeine <- chent$new("caffeine") #' print(caffeine) #' if (!is.null(caffeine$Picture)) { #' plot(caffeine) #' } +#' } plot.chent = function(x, ...) { if (is.null(x$Picture)) stop("No Picture object in chent, was RDKit available during creation?") grid.picture(x$Picture) @@ -651,6 +657,8 @@ plot.chent = function(x, ...) { #' @export #' @format An [R6::R6Class] generator object #' @examples +#' # Don't run examples per default, as PubChem may be unavailable +#' \dontrun{ #' atr <- pai$new("atrazine") #' print(atr) #' if (!is.null(atr$Picture)) { @@ -659,6 +667,7 @@ plot.chent = function(x, ...) { #' # We can also define pais that are not found on the BCPC site #' decanol <- pai$new("1-Decanol") #' print(decanol) +#' } pai <- R6Class("pai", inherit = chent, public = list( diff --git a/man/chent.Rd b/man/chent.Rd index 464c759..b348070 100644 --- a/man/chent.Rd +++ b/man/chent.Rd @@ -12,6 +12,8 @@ information is retrieved from the internet. Additionally, it can be generated using RDKit if RDKit and its python bindings are installed. } \examples{ +# Don't run examples per default, as PubChem may be unavailable +\dontrun{ caffeine <- chent$new("caffeine") print(caffeine) if (!is.null(caffeine$Picture)) { @@ -20,6 +22,7 @@ if (!is.null(caffeine$Picture)) { oct <- chent$new("1-octanol", smiles = "CCCCCCCCO", pubchem = FALSE) print(oct) } +} \section{Public fields}{ \if{html}{\out{
}} \describe{ diff --git a/man/pai.Rd b/man/pai.Rd index c61bb38..2f94b90 100644 --- a/man/pai.Rd +++ b/man/pai.Rd @@ -14,6 +14,8 @@ the complete result of querying the BCPC compendium using \link[webchem:bcpc_query]{bcpc_query}. } \examples{ +# Don't run examples per default, as PubChem may be unavailable +\dontrun{ atr <- pai$new("atrazine") print(atr) if (!is.null(atr$Picture)) { @@ -23,6 +25,7 @@ if (!is.null(atr$Picture)) { decanol <- pai$new("1-Decanol") print(decanol) } +} \section{Super class}{ \code{\link[chents:chent]{chents::chent}} -> \code{pai} } diff --git a/man/plot.chent.Rd b/man/plot.chent.Rd index ecaa01b..1ac1be6 100644 --- a/man/plot.chent.Rd +++ b/man/plot.chent.Rd @@ -15,9 +15,12 @@ Plot method for chent objects } \examples{ +# Don't run examples per default, as PubChem may be unavailable +\dontrun{ caffeine <- chent$new("caffeine") print(caffeine) if (!is.null(caffeine$Picture)) { plot(caffeine) } } +} -- cgit v1.2.3