aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJohannes Ranke <jranke@uni-bremen.de>2019-07-15 14:45:52 +0200
committerJohannes Ranke <jranke@uni-bremen.de>2019-07-15 14:45:52 +0200
commitc8bfe56bd627e1945815631ce5c2ac27333fa246 (patch)
tree666ed7e5d1dc9e3e6c7e64138937a8e0aa641a6e
parent1cc812d69311a1b3f846d0fb160a68a26fe11d65 (diff)
Add chent$emf() function based on devEMF
-rw-r--r--ChangeLog6
-rw-r--r--DESCRIPTION7
-rw-r--r--R/chent.R15
3 files changed, 25 insertions, 3 deletions
diff --git a/ChangeLog b/ChangeLog
index b8c0898..2c43ec8 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,9 @@
+commit 1cc812d69311a1b3f846d0fb160a68a26fe11d65
+Author: Johannes Ranke <jranke@uni-bremen.de>
+Date: 2019-03-20 15:58:34 +0100
+
+ Use shQuote for filename creation in chent$pdf()
+
commit fe9c6bf06cb89ced0f61015bb24a88990a2c8fe8
Author: Johannes Ranke <jranke@uni-bremen.de>
Date: 2019-02-21 16:00:30 +0100
diff --git a/DESCRIPTION b/DESCRIPTION
index 123c12f..a94f482 100644
--- a/DESCRIPTION
+++ b/DESCRIPTION
@@ -1,8 +1,8 @@
Package: chents
Type: Package
Title: Chemical Entities as R Objects
-Version: 0.2-7
-Date: 2019-03-20
+Version: 0.2-8
+Date: 2019-07-13
Authors@R: c(person("Johannes", "Ranke", role = c("aut", "cre", "cph"),
email = "jranke@uni-bremen.de"))
Description: Utilities for dealing with chemical entities and associated
@@ -21,7 +21,8 @@ Suggests:
knitr,
testthat,
PythonInR,
- covr
+ covr,
+ devEMF
License: GPL
LazyLoad: yes
LazyData: yes
diff --git a/R/chent.R b/R/chent.R
index ae23aeb..f3626de 100644
--- a/R/chent.R
+++ b/R/chent.R
@@ -403,6 +403,21 @@ chent <- R6Class("chent",
png(path, antialias = antialias)
plot(self)
dev.off()
+ },
+ emf = function(file = paste0(self$identifier, ".emf"), dir = "structures/emf") {
+ if (!requireNamespace("devEMF")) {
+ stop("You need to have the devEMF package installed for this function")
+ }
+ if (!dir.exists(dir)) {
+ message("Directory '", dir, "' does not exist")
+ message("Trying to create directory '", dir, "'")
+ dir.create(dir, recursive = TRUE)
+ }
+ path = file.path(dir, file)
+ message("Creating file '", path, "'")
+ devEMF::emf(path)
+ plot(self)
+ dev.off()
}
)
)

Contact - Imprint