diff options
author | Ricardo Wurmus <rekado@elephly.net> | 2019-12-13 13:49:24 +0100 |
---|---|---|
committer | Ricardo Wurmus <rekado@elephly.net> | 2019-12-13 22:41:36 +0100 |
commit | 59beb0d23feaa046646bfcc84acb121d10fb2fb0 (patch) | |
tree | 3ca09f66d5f8d49d3f0b5fa99640d37b89e3f107 /gnu/packages/cran.scm | |
parent | db07641a676cf057597fb2e08bac7e391cb846d6 (diff) | |
download | guix-59beb0d23feaa046646bfcc84acb121d10fb2fb0.tar.gz guix-59beb0d23feaa046646bfcc84acb121d10fb2fb0.zip |
gnu: Add r-networkd3.
* gnu/packages/cran.scm (r-networkd3): New variable.
Diffstat (limited to 'gnu/packages/cran.scm')
-rw-r--r-- | gnu/packages/cran.scm | 66 |
1 files changed, 66 insertions, 0 deletions
diff --git a/gnu/packages/cran.scm b/gnu/packages/cran.scm index d6013d3b9f..984b8b8858 100644 --- a/gnu/packages/cran.scm +++ b/gnu/packages/cran.scm @@ -16077,3 +16077,69 @@ representation and principal components analysis. In addition, several utility functions are based on the R graphical environment to provide friendly tools for help in data interpretation.") (license license:gpl2+))) + +;; This package includes minified JavaScript files. When upgrading please +;; check that there are no new minified JavaScript files. +(define-public r-networkd3 + (package + (name "r-networkd3") + (version "0.4") + (source + (origin + (method url-fetch) + (uri (cran-uri "networkD3" version)) + (sha256 + (base32 + "02wxki67drppgfka1is1ykg1f2rxf0x0657c0crj7ipfy62jbf1k")) + (snippet + '(begin + (delete-file "inst/htmlwidgets/lib/d3-4.5.0/d3.min.js") + #t)))) + (properties `((upstream-name . "networkD3"))) + (build-system r-build-system) + (arguments + `(#:modules ((guix build utils) + (guix build r-build-system) + (srfi srfi-1) + (ice-9 popen)) + #:phases + (modify-phases %standard-phases + (add-after 'unpack 'process-javascript + (lambda* (#:key inputs #:allow-other-keys) + (with-directory-excursion "inst/htmlwidgets/lib/" + (call-with-values + (lambda () + (unzip2 + `((,(assoc-ref inputs "d3.v4.js") + "d3-4.5.0/d3.min.js")))) + (lambda (sources targets) + (for-each (lambda (source target) + (format #t "Processing ~a --> ~a~%" + source target) + (let ((minified (open-pipe* OPEN_READ "uglify-js" source))) + (call-with-output-file target + (lambda (port) + (dump-port minified port))))) + sources targets)))) + #t))))) + (native-inputs + `(("uglify-js" ,uglify-js) + ;; NOTE: Make sure that this version of d3 is still valid when + ;; upgrading the package. + ("d3.v4.js" + ,(origin + (method url-fetch) + (uri "https://d3js.org/d3.v4.js") + (sha256 + (base32 + "0y7byf6kcinfz9ac59jxc4v6kppdazmnyqfav0dm4h550fzfqqlg")))))) + (propagated-inputs + `(("r-htmlwidgets" ,r-htmlwidgets) + ("r-igraph" ,r-igraph) + ("r-magrittr" ,r-magrittr))) + (home-page "https://cran.r-project.org/package=networkD3") + (synopsis "D3 JavaScript network graphs from R") + (description + "This package creates D3 JavaScript network, tree, dendrogram, and Sankey +graphs from R.") + (license license:gpl3+))) |