diff --git a/gnu/packages/cran.scm b/gnu/packages/cran.scm index ff274f8f59a..c03a687cfb8 100644 --- a/gnu/packages/cran.scm +++ b/gnu/packages/cran.scm @@ -5285,6 +5285,131 @@ development. It currently provides managers for multiple package specific options and registries, vignette, unit test and bibtex related utilities.") (license license:gpl2+))) +(define-public r-plotly + (package + (name "r-plotly") + (version "4.10.4") + (source (origin + (method url-fetch) + (uri (cran-uri "plotly" version)) + (sha256 + (base32 + "0ryqcs9y7zan36zs6n1hxxy91pajldpax8q7cwcimlsmxnvrbafg")) + (modules '((guix build utils))) + (snippet + '(with-directory-excursion "inst/htmlwidgets/lib/" + (for-each delete-file + '("plotlyjs/plotly-latest.min.js" + "colourpicker/colourpicker.min.js" + "typedarray/typedarray.min.js" + "selectize/selectize.min.js")))))) + (build-system r-build-system) + (arguments + (list + ;; Tests require internet access. + #:tests? #false + #: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) + (with-directory-excursion "inst/htmlwidgets/lib/" + (symlink (string-append (assoc-ref inputs "js-selectize") + "/share/javascript/selectize.min.js") + "selectize/selectize.min.js") + (call-with-values + (lambda () + (unzip2 + `((,(assoc-ref inputs "js-plotly") + "plotlyjs/plotly-latest.min.js") + (,(string-append (assoc-ref inputs "js-colourpicker") + "/js/colourpicker.js") + "colourpicker/colourpicker.min.js") + (,(string-append (assoc-ref inputs "js-typedarray") + "/typedarray.js") + "typedarray/typedarray.min.js")))) + (lambda (sources targets) + (for-each (lambda (source target) + (format #t "Processing ~a --> ~a~%" + source target) + (invoke "esbuild" source "--minify" + (string-append "--outfile=" target))) + sources targets))))))))) + (propagated-inputs + (list r-base64enc + r-crosstalk + r-data-table + r-digest + r-dplyr + r-ggplot2 + r-htmltools + r-htmlwidgets + r-httr + r-jsonlite + r-lazyeval + r-magrittr + r-promises + r-purrr + r-rcolorbrewer + r-rlang + r-scales + r-tibble + r-tidyr + r-vctrs + r-viridislite)) + (native-inputs + `(("esbuild" ,esbuild) + ("js-colourpicker" + ,(let ((commit "27c2a266d51e18a9fe6d7542264152b27c7d34e0") + (version "1.1") + (revision "0")) + (origin + (method git-fetch) + (uri (git-reference + (url "https://github.com/daattali/jquery-colourpicker") + (commit commit))) + (file-name (git-file-name "jquery-colourpicker" + (git-version version revision commit))) + (sha256 + (base32 + "0lg8amh8xh6p246j38rqghrljd7v5z34i169ra6403z8ga33wiqb"))))) + ("js-plotly" + ,(let ((version "2.11.1")) + (origin + (method url-fetch) + (uri (string-append "https://raw.githubusercontent.com/plotly/plotly.js/v" + version "/dist/plotly.js")) + (sha256 + (base32 + "1mxd8s4v3i885w5i02cyzqsrvqfr9w0svdclvqxbd05dly4bdkbj"))))) + ("js-selectize" ,js-selectize) + ;; This is not quite the same as the bundled minified script from 2016, + ;; but it seems to be the original with fixes from late 2017. + ("js-typedarray" + ,(let ((commit "9f7d4168657e2c164d647a6959f402f2c33eb5b4") + (version "0") + (revision "0")) + (origin + (method git-fetch) + (uri (git-reference + (url "https://github.com/inexorabletash/polyfill/") + (commit commit))) + (file-name (git-file-name "typedarray-polyfill" + (git-version version revision commit))) + (sha256 + (base32 + "0f9np4mmyhny03n3xpwzs07rld30lnfqsnh97x1v7xm0qy0zjanf"))))))) + (home-page "https://plot.ly/r") + (synopsis "Create interactive web graphics") + (description + "This package enables the translation of ggplot2 graphs to an interactive +web-based version and/or the creation of custom web-based visualizations +directly from R. Once uploaded to a plotly account, plotly graphs (and the +data behind them) can be viewed and modified in a web browser.") + (license license:x11))) + (define-public r-plyr (package (name "r-plyr") diff --git a/gnu/packages/statistics.scm b/gnu/packages/statistics.scm index 6d35b538a20..6e0aa5a4b47 100644 --- a/gnu/packages/statistics.scm +++ b/gnu/packages/statistics.scm @@ -2069,131 +2069,6 @@ and tidyr provides no margins or aggregation.") features present in other programming languages.") (license license:gpl3+))) -(define-public r-plotly - (package - (name "r-plotly") - (version "4.10.4") - (source (origin - (method url-fetch) - (uri (cran-uri "plotly" version)) - (sha256 - (base32 - "0ryqcs9y7zan36zs6n1hxxy91pajldpax8q7cwcimlsmxnvrbafg")) - (modules '((guix build utils))) - (snippet - '(with-directory-excursion "inst/htmlwidgets/lib/" - (for-each delete-file - '("plotlyjs/plotly-latest.min.js" - "colourpicker/colourpicker.min.js" - "typedarray/typedarray.min.js" - "selectize/selectize.min.js")))))) - (build-system r-build-system) - (arguments - (list - ;; Tests require internet access. - #:tests? #false - #: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) - (with-directory-excursion "inst/htmlwidgets/lib/" - (symlink (string-append (assoc-ref inputs "js-selectize") - "/share/javascript/selectize.min.js") - "selectize/selectize.min.js") - (call-with-values - (lambda () - (unzip2 - `((,(assoc-ref inputs "js-plotly") - "plotlyjs/plotly-latest.min.js") - (,(string-append (assoc-ref inputs "js-colourpicker") - "/js/colourpicker.js") - "colourpicker/colourpicker.min.js") - (,(string-append (assoc-ref inputs "js-typedarray") - "/typedarray.js") - "typedarray/typedarray.min.js")))) - (lambda (sources targets) - (for-each (lambda (source target) - (format #t "Processing ~a --> ~a~%" - source target) - (invoke "esbuild" source "--minify" - (string-append "--outfile=" target))) - sources targets))))))))) - (propagated-inputs - (list r-base64enc - r-crosstalk - r-data-table - r-digest - r-dplyr - r-ggplot2 - r-htmltools - r-htmlwidgets - r-httr - r-jsonlite - r-lazyeval - r-magrittr - r-promises - r-purrr - r-rcolorbrewer - r-rlang - r-scales - r-tibble - r-tidyr - r-vctrs - r-viridislite)) - (native-inputs - `(("esbuild" ,esbuild) - ("js-colourpicker" - ,(let ((commit "27c2a266d51e18a9fe6d7542264152b27c7d34e0") - (version "1.1") - (revision "0")) - (origin - (method git-fetch) - (uri (git-reference - (url "https://github.com/daattali/jquery-colourpicker") - (commit commit))) - (file-name (git-file-name "jquery-colourpicker" - (git-version version revision commit))) - (sha256 - (base32 - "0lg8amh8xh6p246j38rqghrljd7v5z34i169ra6403z8ga33wiqb"))))) - ("js-plotly" - ,(let ((version "2.11.1")) - (origin - (method url-fetch) - (uri (string-append "https://raw.githubusercontent.com/plotly/plotly.js/v" - version "/dist/plotly.js")) - (sha256 - (base32 - "1mxd8s4v3i885w5i02cyzqsrvqfr9w0svdclvqxbd05dly4bdkbj"))))) - ("js-selectize" ,js-selectize) - ;; This is not quite the same as the bundled minified script from 2016, - ;; but it seems to be the original with fixes from late 2017. - ("js-typedarray" - ,(let ((commit "9f7d4168657e2c164d647a6959f402f2c33eb5b4") - (version "0") - (revision "0")) - (origin - (method git-fetch) - (uri (git-reference - (url "https://github.com/inexorabletash/polyfill/") - (commit commit))) - (file-name (git-file-name "typedarray-polyfill" - (git-version version revision commit))) - (sha256 - (base32 - "0f9np4mmyhny03n3xpwzs07rld30lnfqsnh97x1v7xm0qy0zjanf"))))))) - (home-page "https://plot.ly/r") - (synopsis "Create interactive web graphics") - (description - "This package enables the translation of ggplot2 graphs to an interactive -web-based version and/or the creation of custom web-based visualizations -directly from R. Once uploaded to a plotly account, plotly graphs (and the -data behind them) can be viewed and modified in a web browser.") - (license license:x11))) - (define-public r-rematch (package (name "r-rematch")