From c8bfe56bd627e1945815631ce5c2ac27333fa246 Mon Sep 17 00:00:00 2001 From: Johannes Ranke Date: Mon, 15 Jul 2019 14:45:52 +0200 Subject: Add chent$emf() function based on devEMF --- ChangeLog | 6 ++++++ DESCRIPTION | 7 ++++--- R/chent.R | 15 +++++++++++++++ 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 +Date: 2019-03-20 15:58:34 +0100 + + Use shQuote for filename creation in chent$pdf() + commit fe9c6bf06cb89ced0f61015bb24a88990a2c8fe8 Author: Johannes Ranke 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() } ) ) -- cgit v1.2.1