summaryrefslogtreecommitdiff
path: root/R
diff options
context:
space:
mode:
Diffstat (limited to 'R')
-rw-r--r--R/chent.R15
1 files changed, 12 insertions, 3 deletions
diff --git a/R/chent.R b/R/chent.R
index 05066b8..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
@@ -219,10 +222,10 @@ chent <- R6Class("chent",
#' @description
#' Get chemical information from RDKit if available
get_rdkit = function(template = NULL) {
-
+
if (!rdkit_available) stop("RDKit is not available")
if (is.null(self$smiles)) stop("RDKit would need a SMILES code")
-
+
available_smiles <- names(self$smiles)
smiles_preference <- c("user", "PubChem", "PubChem_Connectivity")
smiles_preferred_i <- min(match(available_smiles, smiles_preference))
@@ -492,7 +495,7 @@ chent <- R6Class("chent",
#' @param N The Freundlich exponent
#' @param perc_clay The percentage of clay in the soil
#' @param CEC The cation exchange capacity
- add_soil_sorption = function(soils,
+ add_soil_sorption = function(soils,
Kf, Kfoc, N,
type = NA, pH_orig = NA, pH_medium = NA,
pH_H2O = NA,
@@ -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(

Contact - Imprint