[R-pkg-devel] Acknowledging small functions from another package
Hi, One of my packages copy-pasted some small functions (stuff like `%||%` for is.null) from ggplot2. (Both packages are MIT-licensed.) What is an appropriate way to acknowledge this in the DESCRIPTION Author: or Authors@R section? (Note that the list of ggplot2 authors is long and changing.) Cheers, David [[alternative HTML version deleted]] __ R-package-devel@r-project.org mailing list https://stat.ethz.ch/mailman/listinfo/r-package-devel
Re: [R-pkg-devel] Acknowledging small functions from another package
On Thu, 4 May 2023 09:21:17 +0100 David Hugh-Jones wrote: > One of my packages copy-pasted some small functions (stuff like > `%||%` for is.null) from ggplot2. (Both packages are MIT-licensed.) > > What is an appropriate way to acknowledge this in the DESCRIPTION > Author: or Authors@R section? One way would be to mention Hadley Wickham: https://github.com/tidyverse/ggplot2/commit/ef2f944863a0db8841bf628e9eb4a9faef5049e6#diff-8f53135445ab98749043fa52e438346bb9acae8e0185aa95f186d0aa021bb7e0 (`git blame` will also tell you that he later moved this function to a different file). I think that person('ggplot2 authors', role = 'cph', comment = 'The %||% operator') is also fine, just like e.g. unitizer package mentions the code taken from R itself. You can also find this operator in multiple base R packages, currently unexported (maybe some day...). They mention in the comments that the operator is adapted from ggplot2. -- Best regards, Ivan __ R-package-devel@r-project.org mailing list https://stat.ethz.ch/mailman/listinfo/r-package-devel
Re: [R-pkg-devel] Acknowledging small functions from another package
On 04/05/2023 4:53 a.m., Ivan Krylov wrote: On Thu, 4 May 2023 09:21:17 +0100 David Hugh-Jones wrote: One of my packages copy-pasted some small functions (stuff like `%||%` for is.null) from ggplot2. (Both packages are MIT-licensed.) What is an appropriate way to acknowledge this in the DESCRIPTION Author: or Authors@R section? One way would be to mention Hadley Wickham: https://github.com/tidyverse/ggplot2/commit/ef2f944863a0db8841bf628e9eb4a9faef5049e6#diff-8f53135445ab98749043fa52e438346bb9acae8e0185aa95f186d0aa021bb7e0 (`git blame` will also tell you that he later moved this function to a different file). I think that person('ggplot2 authors', role = 'cph', comment = 'The %||% operator') is also fine, just like e.g. unitizer package mentions the code taken from R itself. You can also find this operator in multiple base R packages, currently unexported (maybe some day...). They mention in the comments that the operator is adapted from ggplot2. I'd probably use role = "ctb" instead for "ggplot2 authors", and include Posit PBC as a copyright holder (as ggplot2 does). Presumably you or others are also copyright holders for your package and should also have role = "cph" added so it doesn't give the impression that Posit owns everything. Duncan Murdoch __ R-package-devel@r-project.org mailing list https://stat.ethz.ch/mailman/listinfo/r-package-devel
Re: [R-pkg-devel] How to declare Bioconductor Dependencies in the Description File of my R Package
On 03.05.2023 23:00, Simon Urbanek wrote: On May 4, 2023, at 3:36 AM, Martin Morgan wrote: CRAN is fine with Bioconductor Depends: and Imports: dependencies, as previously mentioned. This is because the CRAN maintainers explicitly configure their system to know about Bioconductor package repositories. That is not exactly true (at least not for all maintainers ;)). Bioconductor packages are installed on as-needed (best-effort) basis and it is a manual process. Apparently for MacOS. On Fedora/Debian/WIndows we auto install from BioC. (actually, on Windows all BioC software packages are preinstalled). Best, Uwe Ligges Ideally, Bioconductor packages would be in Suggests, because if they are not, the package binary will be effectively broken for most users as they cannot install it without additional steps (and no stable state can be guaranteed, either). That's why I believe someone was suggesting a pre-flight check that alerts the user to such situation and prints instructions to remedy it (e.g., to use setRepositories()) as the majority of users will have no idea what's going on. Cheers, Simon Users face a different challenge -- many users will not have identified (e.g., via `setRepositories()` a Bioconductor repository, so when they try to install your package it will fail in a way that you have no control over -- a generic message saying that the Bioconductor dependencies was not found. You could mitigate this by advertising that your CRAN package should be installed via `BiocManager::install("")`, which defines appropriate repositories for both CRAN and Bioconductor, but there is no way to unambiguously communicate this to users. Martin From: R-package-devel on behalf of Ruff, Sergej Date: Wednesday, May 3, 2023 at 11:13 AM To: Dirk Eddelbuettel Cc: r-package-devel@r-project.org Subject: Re: [R-pkg-devel] How to declare Bioconductor Dependencies in the Description File of my R Package Thank you, Dirk. I see your dependencies are Suggested. I know that Suggested dependencies should be conditional. Do you know if Non-Cran (Bioconductor) packages need to be conditional? Do you have any experiece regarding Non-CRAN Dependencies and how to handle them? I believe Duncan Murdoch's experience and opinion regarding that topic, but i take any second and third opinion to be sure. Thank you for your help. Sergej Von: Dirk Eddelbuettel Gesendet: Mittwoch, 3. Mai 2023 16:22:09 An: Ruff, Sergej Cc: Duncan Murdoch; Ivan Krylov; r-package-devel@r-project.org Betreff: Re: [R-pkg-devel] How to declare Bioconductor Dependencies in the Description File of my R Package Sergej, Please consider: - there are nearly 20k CRAN packages - all of them are mirrored at https://github.com/cran so you can browse - pick any one 'heavy' package you like, Seurat is a good example; there are other examples in geospatial or bioinformatics etc - you can browse _and search_ these to your hearts content Here is an example of mine. In RcppArmadillo, years ago we (thanks to fine Google Summer of Code work by Binxiang Ni) added extended support for sparse matrices pass-through / conversione from R to C++ / Armadillo and back. That is clearly an optional feature as most uses of (Rcpp)Armadillo use dense matrices. So all code and test code is _conditional_. File DESCRIPTION has Suggests: [...], Matrix (>= 1.3.0), [...], reticulate, slam mostly for tests. I.e. We have very little R code: in one single file R/SciPy2R.R we switched to doing this via reticulate and opee the function with if (!requireNamespace("reticulate", quietly=TRUE)) { stop("You must install the 'reticulate' package (and have SciPy).", call.=FALSE) } after an actual deprecation warning (as there was scipy converter once). Similarly, the testsuites in inst/tinytests/* have several if (!requireNamespace("Matrix", quietly=TRUE)) exit_file("No Matrix package") as well as if (!requireNamespace("reticulate", quietly=TRUE)) exit_file("Package reticulate missing") if (!packageVersion("reticulate") >= package_version("1.14")) exit_file("SciPy not needed on newer reticulate") and tests for slam (another sparse matrix package besides the functionality in Matrix). Hopefully this brief snapshot gives you an idea. There are (likely!!) thousandss of examples you can browse, and I am sure you will find something. If you have further (concrete) questions please do not hesitate to use the resource of this list. Cheers (or I should say "mit Braunschweiger Gruessen nach Hannover), Dirk -- dirk.eddelbuettel.com | @eddelbuettel | e...@debian.org [[alternative HTML version deleted]] __ R-package-devel@r-project.org mailing list https://stat.ethz.ch/mailman/listinfo/r-package-devel [[alternative HTML version deleted]] __ R-pack
Re: [R-pkg-devel] Acknowledging small functions from another package
Thank you both. This sounds sensible. Yeah, add my vote for `base::%||%`!! David On Thu, 4 May 2023 at 10:00, Duncan Murdoch wrote: > On 04/05/2023 4:53 a.m., Ivan Krylov wrote: > > On Thu, 4 May 2023 09:21:17 +0100 > > David Hugh-Jones wrote: > > > >> One of my packages copy-pasted some small functions (stuff like > >> `%||%` for is.null) from ggplot2. (Both packages are MIT-licensed.) > >> > >> What is an appropriate way to acknowledge this in the DESCRIPTION > >> Author: or Authors@R section? > > > > One way would be to mention Hadley Wickham: > > > https://github.com/tidyverse/ggplot2/commit/ef2f944863a0db8841bf628e9eb4a9faef5049e6#diff-8f53135445ab98749043fa52e438346bb9acae8e0185aa95f186d0aa021bb7e0 > > (`git blame` will also tell you that he later moved this function to a > > different file). > > > > I think that person('ggplot2 authors', role = 'cph', comment = 'The > > %||% operator') is also fine, just like e.g. unitizer package mentions > > the code taken from R itself. > > > > You can also find this operator in multiple base R packages, currently > > unexported (maybe some day...). They mention in the comments that the > > operator is adapted from ggplot2. > > I'd probably use role = "ctb" instead for "ggplot2 authors", and include > Posit PBC as a copyright holder (as ggplot2 does). Presumably you or > others are also copyright holders for your package and should also have > role = "cph" added so it doesn't give the impression that Posit owns > everything. > > Duncan Murdoch > > [[alternative HTML version deleted]] __ R-package-devel@r-project.org mailing list https://stat.ethz.ch/mailman/listinfo/r-package-devel
Re: [R-pkg-devel] Acknowledging small functions from another package
IMO those functions are so small that you don't need to call them out in your DESCRIPTION. Just note in a nearby comment where they came from. Hadley On Thu, May 4, 2023 at 3:21 AM David Hugh-Jones wrote: > > Hi, > > One of my packages copy-pasted some small functions (stuff like `%||%` for > is.null) from ggplot2. (Both packages are MIT-licensed.) > > What is an appropriate way to acknowledge this in the DESCRIPTION Author: > or Authors@R section? (Note that the list of ggplot2 authors is long and > changing.) > > Cheers, > David > > [[alternative HTML version deleted]] > > __ > R-package-devel@r-project.org mailing list > https://stat.ethz.ch/mailman/listinfo/r-package-devel -- http://hadley.nz __ R-package-devel@r-project.org mailing list https://stat.ethz.ch/mailman/listinfo/r-package-devel
Re: [R-pkg-devel] Acknowledging small functions from another package
In fact Martin Maechler added this in 2021: https://github.com/wch/r-source/blob/trunk/src/library/utils/R/str.R#L19-L21 ## A pearl from ggplot2 et al. NB: often needs '(.)' :%||% ( ) ## *not exported* [should rather be in 'base' than exported here] `%||%` <- function(L,R) if(is.null(L)) R else L On 2023-05-04 5:59 a.m., David Hugh-Jones wrote: Thank you both. This sounds sensible. Yeah, add my vote for `base::%||%`!! David On Thu, 4 May 2023 at 10:00, Duncan Murdoch wrote: On 04/05/2023 4:53 a.m., Ivan Krylov wrote: On Thu, 4 May 2023 09:21:17 +0100 David Hugh-Jones wrote: One of my packages copy-pasted some small functions (stuff like `%||%` for is.null) from ggplot2. (Both packages are MIT-licensed.) What is an appropriate way to acknowledge this in the DESCRIPTION Author: or Authors@R section? One way would be to mention Hadley Wickham: https://github.com/tidyverse/ggplot2/commit/ef2f944863a0db8841bf628e9eb4a9faef5049e6#diff-8f53135445ab98749043fa52e438346bb9acae8e0185aa95f186d0aa021bb7e0 (`git blame` will also tell you that he later moved this function to a different file). I think that person('ggplot2 authors', role = 'cph', comment = 'The %||% operator') is also fine, just like e.g. unitizer package mentions the code taken from R itself. You can also find this operator in multiple base R packages, currently unexported (maybe some day...). They mention in the comments that the operator is adapted from ggplot2. I'd probably use role = "ctb" instead for "ggplot2 authors", and include Posit PBC as a copyright holder (as ggplot2 does). Presumably you or others are also copyright holders for your package and should also have role = "cph" added so it doesn't give the impression that Posit owns everything. Duncan Murdoch [[alternative HTML version deleted]] __ R-package-devel@r-project.org mailing list https://stat.ethz.ch/mailman/listinfo/r-package-devel -- Dr. Benjamin Bolker Professor, Mathematics & Statistics and Biology, McMaster University Director, School of Computational Science and Engineering (Acting) Graduate chair, Mathematics & Statistics > E-mail is sent at my convenience; I don't expect replies outside of working hours. __ R-package-devel@r-project.org mailing list https://stat.ethz.ch/mailman/listinfo/r-package-devel