diff options
-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") |