diff options
author | Ricardo Wurmus <rekado@elephly.net> | 2023-02-13 22:04:12 +0100 |
---|---|---|
committer | Ricardo Wurmus <rekado@elephly.net> | 2023-02-13 22:06:17 +0100 |
commit | f223f773a4e52d17643191c667ed3eef6270cb09 (patch) | |
tree | 06da71ffb36c1e6864cdf066b2e5a79cb5b7e4b2 /gnu | |
parent | dd724cfad45d76b9dcc5b073876c995715c92a07 (diff) | |
download | guix-f223f773a4e52d17643191c667ed3eef6270cb09.tar.gz |
gnu: Add r-visnetwork.
* gnu/packages/cran.scm (r-visnetwork): New variable.
Diffstat (limited to 'gnu')
-rw-r--r-- | gnu/packages/cran.scm | 92 |
1 files changed, 92 insertions, 0 deletions
diff --git a/gnu/packages/cran.scm b/gnu/packages/cran.scm index 7ca7ab0f9a..b4dc7822f2 100644 --- a/gnu/packages/cran.scm +++ b/gnu/packages/cran.scm @@ -30777,6 +30777,98 @@ data visualisations of an entire dataset to identify problems or unexpected feat using @code{ggplot2}.") (license license:expat))) +(define-public r-visnetwork + (package + (name "r-visnetwork") + (version "2.1.2") + (source + (origin + (method url-fetch) + (uri (cran-uri "visNetwork" version)) + (sha256 + (base32 + "116w3l65lgv18xzav5zz1pbgwpwck66n9cjpja9axrl9zi19vja7")) + (snippet + '(for-each delete-file + '("inst/htmlwidgets/lib/vis/vis-network.min.js" + "inst/htmlwidgets/lib/export/FileSaver/FileSaver.min.js" + "inst/common-docs-files/js/jquery.url.min.js"))))) + (properties `((upstream-name . "visNetwork"))) + (build-system r-build-system) + (arguments + (list + #:modules '((guix build utils) + (guix build r-build-system) + (srfi srfi-1)) + #:phases + '(modify-phases %standard-phases + (add-after 'unpack 'process-javascript + (lambda* (#:key inputs #:allow-other-keys) + ;; The inst directory contains some minified JavaScript + ;; files. Regenerate them from sources. + (with-directory-excursion "inst/" + (call-with-values + (lambda () + (unzip2 + `((,(search-input-file inputs "/FileSaver.js") + "htmlwidgets/lib/export/FileSaver/FileSaver.min.js") + (,(search-input-file inputs "/url.js") + "common-docs-files/js/jquery.url.min.js") + (,(assoc-ref inputs "vis-network.js") + "htmlwidgets/lib/vis/vis-network.min.js")))) + (lambda (sources targets) + (for-each (lambda (source target) + (format #true "Processing ~a --> ~a~%" + source target) + (invoke "esbuild" source "--minify" + (string-append "--outfile=" target))) + sources targets))))))))) + (propagated-inputs + (list r-htmltools + r-htmlwidgets + r-jsonlite + r-magrittr)) + (native-inputs + `(("r-knitr" ,r-knitr) + ("esbuild" ,esbuild) + ;; The included file has no version information but was created + ;; at around the same time as version 9.1.0. + ("vis-network.js" + ,(origin + (method url-fetch) + (uri "https://unpkg.com/vis-network@9.1.0/dist/vis-network.js") + (sha256 + (base32 + "0vh2zf221ildsr5ly9idxi3jpqx61j3phbz5kdd801i0crqk4yj0")))) + ;; Version 1.2.0 is a few months more recent than what + ;; visNetwork bundles. + ("filesaver.js" + ,(origin + (method git-fetch) + (uri (git-reference + (url "https://github.com/eligrey/FileSaver.js/") + (commit "1.2.0"))) + (file-name (git-file-name "FileSaver.js" "1.2.0")) + (sha256 + (base32 + "07mw01056fk36pganhs27y8rl5y5hrdsm945pwbbvmdjnzq4ijny")))) + ("jquery-url.js" + ,(origin + (method git-fetch) + (uri (git-reference + (url "https://github.com/websanova/js-url/") + (commit "v1.8.6"))) + (file-name (git-file-name "js-url.js" "1.8.6")) + (sha256 + (base32 + "0pxqjwqf9avd4d99csgny8xf5c65kyqjnm24pwm4ca1zghsl9wyr")))))) + (home-page "https://datastorm-open.github.io/visNetwork/") + (synopsis "Network Visualization using vis.js Library") + (description + "This package provides an R interface to the vis.js JavaScript charting +library. It allows an interactive visualization of networks.") + (license license:expat))) + (define-public r-muhaz (package (name "r-muhaz") |