pakillo / grateful Goto Github PK
View Code? Open in Web Editor NEWFacilitate citation of R packages
Home Page: https://pakillo.github.io/grateful/
License: Other
Facilitate citation of R packages
Home Page: https://pakillo.github.io/grateful/
License: Other
I'm trying to override the "Missing" default on NA values.
When I put it in tm_text, it does not override.
tm_shape(CAR) + tm_polygons("Graduates") +
tm_text("Label_Name", just = "top", auto.placement = TRUE, textNA = "No Frontline", colorNA = "#CC0000", col = "#000000") +
tm_layout(main.title = "Frontline Graduates by Country\nCaribbean", main.title.position = "center", inner.margins = c(.1, .2, .1, .2))
If I add a tm_fill layer, I get a warning that
tm_shape(CAR) + tm_polygons("Graduates") + tm_fill(textNA = "Frontline not implemented") +
tm_text("Label_Name", just = "top", auto.placement = TRUE, textNA = "No Frontline", colorNA = "#CC0000", col = "#000000") +
tm_layout(main.title = "Frontline Graduates by Country\nCaribbean", main.title.position = "center", inner.margins = c(.1, .2, .1, .2))
One tm layer group has duplicated layer types, which are omitted.
Any help would be appreciated.
Thanks
Really like the grateful
package! But I've noticed it doesn't pick up packages that have been loaded via the p_load
function in pacman
. In the future, would you consider adding an extension to include packages in citations that have been loaded through pacman
? There is a p_citation
function in pacman
that might be of use here, else perhaps a way to search for packages loaded via both standard library
calls and via p_load
?
More info on pacman
here: https://cran.r-project.org/web/packages/pacman/pacman.pdf
Thanks for your consideration and keep up the good work!
Would be good to be able to read options like the output format, citation processor (pandoc-citeproc or BibTeX), and any CSL files that are set in the document's YAML header, rather than having to also pass them to grateful. In particular:
cite_packages(…, citation.style)
nocite_references(…, citation_processor)
First release:
usethis::use_cran_comments()
Title:
and Description:
attachment::att_amend_desc()
@return
and @examples
Authors@R:
includes a copyright holder (role 'cph')spelling::spell_check_package()
or devtools::spell_check()
devtools::run_examples()
devtools::test_coverage()
goodpractice::gp()
rcmdcheck::rcmdcheck(args = c("--no-manual", "--as-cran"))
Prepare for release:
git pull
devtools::build_readme()
urlchecker::url_check()
devtools::check(remote = TRUE, manual = TRUE)
devtools::check_win_devel()
devtools::check_mac_release()
devtools::check_rhub()
or rhub::check_for_cran()
git push
Submit to CRAN:
devtools::release()
Wait for CRAN...
git push
usethis::use_github_release()
usethis::use_dev_version()
git push
It seems that grateful
relies on AED
which has been discontinued.
For CRAN submission:
https://r-pkgs.org/release.html
https://github.com/ThinkR-open/prepare-for-cran
https://github.com/johnmackintosh/CRANt-touch-this
https://github.com/DavisVaughan/extrachecks
https://cran.r-project.org/web/packages/submission_checklist.html
https://cran.r-project.org/web/packages/policies.html
https://www.marinedatascience.co/blog/2020/01/09/checklist-for-r-package-re-submissions-on-cran/
Hi @Pakillo.
I love this pkg, and I use it a lot. Thanks.
Recently I'm creating new projects with quarto documents, so I would like to continue using this amazing pkg. Are you planing to include an option to also scan .qmd documents?
pkgs that are loaded, ie. library(pkg), but then no function is used.
funchir::stale_package_check
detects such unused packages: https://github.com/MichaelChirico/funchir/blob/master/R/utils.R#L146. See example https://stackoverflow.com/a/43331282
Not sure if it's just on my machine, but because I didn't have rlang installed, I got the error:
Error: Failed to install 'grateful' from GitHub:
(converted from warning) cannot remove prior installation of package ‘rlang
Installed rlang and then installation works.
Dear,
I fail to install this R package (in the last released of Rstudio with R4.1.1) whereas it's seems to be very helpful.
When I copy/paste the install command line remotes::install_github("Pakillo/grateful")
, I have these errors in return :
Erreur : Failed to install 'unknown package' from GitHub: error:1400410B:SSL routines:CONNECT_CR_SRVR_HELLO:wrong version number
Someone could help me ?
Error loading grateful
> library(grateful)
Error: package or namespace load failed for ‘grateful’:
object ‘scanForPackages’ is not exported by 'namespace:checkpoint'
> sessionInfo()
R version 4.0.5 (2021-03-31)
Platform: x86_64-apple-darwin17.0 (64-bit)
Running under: macOS Mojave 10.14.6
Matrix products: default
BLAS: /System/Library/Frameworks/Accelerate.framework/Versions/A/Frameworks/vecLib.framework/Versions/A/libBLAS.dylib
LAPACK: /Library/Frameworks/R.framework/Versions/4.0/Resources/lib/libRlapack.dylib
locale:
[1] es_ES.UTF-8/es_ES.UTF-8/es_ES.UTF-8/C/es_ES.UTF-8/es_ES.UTF-8
attached base packages:
[1] stats graphics grDevices utils datasets methods base
loaded via a namespace (and not attached):
[1] compiler_4.0.5 cli_2.5.0 htmltools_0.5.1.1 tools_4.0.5
[5] yaml_2.2.1 rmarkdown_2.9 knitr_1.33 xfun_0.24
[9] digest_0.6.27 checkpoint_1.0.0 rlang_0.4.11 evaluate_0.14 ```
The help-file for cite_packages()
refers for possible citation styles for the styles
argument to http://citationstyles.org/styles/. This URL is not valid. The styles are now available at https://github.com/citation-style-language/styles (I guess this is the webpage that is meant).
No RStudio in the output table after knitting:
---
title: "Untitled"
output: html_document
bibliography: grateful-refs.bib
---
```{r}
library(R.utils)
library(grateful)
cite_packages(output = "table", out.dir = ".", include.RStudio = TRUE)
```
Replacing the last line with cite_packages(output = "paragraph", out.dir = ".", include.RStudio = TRUE)
leads to RStudio being cited.
See https://github.com/yihui/knitr/blob/6d270bad4f661bce30cb29ada3ac2513d27bf997/R/citation.R for possible solution
Hello,
I get this error when trying to install your package via devtools::install_github
ERROR: dependency 'checkpoint' is not available for package 'grateful'
I am also unable to download the zip and install that way as well, as R tells me that it is not a properly installed binary package.
Thanks for your assistance.
Fred
Great idea, but it should work within markdown and bookdown files, eg.:
```{r}
library(grateful)
cite_packages()
Hi,
I just saw a post about your package on social media. Very cool!
I am the author of softbib
, which does essentially the same thing: https://github.com/vincentarelbundock/softbib
Looking at CRAN release dates, this looks like another case of simultaneous invention: I released on March 3rd 2023 and you on April 24th of the same year.
I think this is a really important feature set, and I believe in software citations (I recently published a paper about this in my discipline: https://doi.org/10.1017/S1049096523000239)
But I'm not sure we need TWO packages for this. My preferred outcome would be to join efforts somehow, to avoid duplicating efforts and splitting the community across different workflows.
What do you think? If you look at softbib
, do you see a path forward, or are the projects on different paths?
In some circumstances, the included wording may not be ideal for the citation paragraph. (E.g., authorial “we” isn’t used in the humanities and some social sciences for a single-author paper.)
In the long term, a templating system could be helpful. For the short term, a passive-voice option could add a lot of flexibility.
Currently, using just the first one (utils::citation default). But some pkgs include > 1 citation (e.g. knitr)
Very interesting package!
Just wondering if it is possible to have a post-processing that removes the individual package citation once the collection is cited. For example, if tidyverse
is cited, there's no need to cite ggplot2
separately.
This might be also applied to other package collections.
Hi,
When I'm checking the reverse dependencies of knitr, I discovered that grateful had some tests that were too strict, e.g.,
grateful/tests/testthat/test-utils_citations.R
Lines 57 to 88 in a0859f7
These tests assume that the citations for knitr would never change, which is not true, e.g., next year knitr2023
will become knitr2024
and the test would be broken, or new books/papers about knitr could be written and there could be more citation entries in https://github.com/yihui/knitr/blob/master/inst/CITATION, etc.
I'll be grateful if these tests are either removed or skipped on CRAN, so that I can freely make changes in knitr's citations in future without breaking grateful's tests. Thank you!
Hi, I'm curious if you've considered adding a out.path
parameter to the cite_packages()
function.
I'd love to be able to do the following:
docs
folderout.format
to NULL
in cases where I want the out.format
to be the .Rmd
file.My idea is for the default out.path
to be null and it'd save it in the top love of the project folder.
cite_packages(out.format = "md". out.path = "docs")
I'm more than willing to contribute this change as well as add some a pkgdown
site if that's desired.
This package has saved me a TON of time @Pakillo
It would be nice to add an option to cite R itself when using the argument pkgs
. A simple workaround is to add "base"
to pkgs
but this maybe could be done automatically...?
Example:
cite_packages(pkgs = c("grateful", "knitr"), output = "paragraph", out.dir = ".")
vs.
cite_packages(pkgs = c("grateful", "knitr", "base"), output = "paragraph", out.dir = ".")
passive.voice = TRUE works well when output = "paragraph", but not when output = "file" (i.e. when generating a report).
Of course, I realised this just after releasing the new version on CRAN...
Hi Pakillo,
I just found grateful and it's is great!..
I would like to suggest you if you can include, after the doi address of the citation, a "date access" information.
In some journals when I have cited some R packages they ask to me to include the date when I have access to the package in square brackets.
something like:
R Core Team (2013). R: A language and environment for statistical
computing. R Foundation for Statistical Computing, Vienna, Austria.
URL http://www.R-project.org/. [Accessed on August 2017]
Depending on R versions >=3.4.1 seems kind of restrictive.
grateful won't install on my installation of R 3.4.0, but if I modify DESCRIPTION and rebuild, it seems to run just fine. Is there any reason you want to restrict to a recent version, or just that you haven't tested old versions?
Great package! Heads-up (in case useful): I just ran the following lines to generate a .bib file. Worth having a function to do this in the pkg? I suspect so...
pkgs = c(
"grateful",
"sf",
"osmdata",
"dodgr",
"stplanr",
"dplyr",
"piggyback",
"tidygraph",
"sfnetworks",
"purrr",
"devtools"
)
to_install = !pkgs %in% installed.packages()
if(any(to_install)) {
install.packages(pkgs[to_install])
}
devtools::install_github("Pakillo/grateful")
#> Skipping install of 'grateful' from a github remote, the SHA1 (5fc74648) has not changed since last install.
#> Use `force = TRUE` to force installation
purrr::map_lgl(pkgs, require, character.only = TRUE)
#> Loading required package: grateful
#> Loading required package: sf
#> Linking to GEOS 3.7.0, GDAL 2.3.2, PROJ 5.2.0
#> Loading required package: osmdata
#> Data (c) OpenStreetMap contributors, ODbL 1.0. http://www.openstreetmap.org/copyright
#> Loading required package: dodgr
#> Loading required package: stplanr
#> Warning in fun(libname, pkgname): rgeos: versions of GEOS runtime 3.7.0-CAPI-1.11.0
#> and GEOS at installation 3.6.2-CAPI-1.10.2differ
#> Loading required package: dplyr
#>
#> Attaching package: 'dplyr'
#> The following objects are masked from 'package:stats':
#>
#> filter, lag
#> The following objects are masked from 'package:base':
#>
#> intersect, setdiff, setequal, union
#> Loading required package: piggyback
#> Loading required package: tidygraph
#>
#> Attaching package: 'tidygraph'
#> The following object is masked from 'package:stats':
#>
#> filter
#> Loading required package: sfnetworks
#> Loading required package: purrr
#> Loading required package: devtools
#> [1] TRUE TRUE TRUE TRUE TRUE TRUE TRUE TRUE TRUE TRUE TRUE
cites = grateful::get_citations(pkgs)
#> Warning in FUN(X[[i]], ...): no date field in DESCRIPTION file of package
#> 'dplyr'
#> Warning in FUN(X[[i]], ...): no date field in DESCRIPTION file of package
#> 'sfnetworks'
lapply(cites, write, file = "pkg.bib", append = TRUE)
#> $grateful
#> NULL
#>
#> $sf
#> NULL
#>
#> $osmdata
#> NULL
#>
#> $dodgr
#> NULL
#>
#> $stplanr
#> NULL
#>
#> $dplyr
#> NULL
#>
#> $piggyback
#> NULL
#>
#> $tidygraph
#> NULL
#>
#> $sfnetworks
#> NULL
#>
#> $purrr
#> NULL
#>
#> $devtools
#> NULL
Created on 2019-01-08 by the reprex package (v0.2.1)
Prepare for release:
git pull
usethis::use_github_links()
urlchecker::url_check()
devtools::build_readme()
devtools::check(remote = TRUE, manual = TRUE)
devtools::check_win_devel()
revdepcheck::revdep_check(num_workers = 4)
cran-comments.md
git push
Submit to CRAN:
usethis::use_version('patch')
devtools::submit_cran()
Wait for CRAN...
usethis::use_github_release()
usethis::use_dev_version(push = TRUE)
Hi, this is a follow-up of the conversation on mastodon @sdruskat https://scholar.social/@sdruskat/110264829977856739
Just for introducing you a bit the cffr package this is a quick demo that show:
bibentry
(BibTex) entry# Read a CITATION.cff file
f <- system.file("examples/reprozip.cff", package = "cffr")
library(cffr)
# cffr has its own class cff
cff_s3_class <-cff_read(f)
class(cff_s3_class)
#> [1] "cff"
# You can parse it to bibentries
tobib <- cff_to_bibtex(cff_s3_class, what = "preferred")
class(tobib)
#> [1] "bibentry"
tobib
#> Anonymous (ed.) (2016). _ReproZip: Computational Reproducibility With
#> Ease_, series SIGMOD '16. doi:10.1145/2882903.2899401
#> <https://doi.org/10.1145/2882903.2899401>.
# Use with grateful
library(grateful)
citekeys <- get_citations(c("knitr", "renv"), out.dir = tempdir())
# Read to bibtex file created
fgrateful <- file.path(tempdir(), "grateful-refs.bib")
readLines(fgrateful)
#> [1] "@Manual{knitr2023,"
#> [2] "title = {{knitr}: A General-Purpose Package for Dynamic Report Generation in R},"
#> [3] " author = {Yihui Xie},"
#> [4] " year = {2023},"
#> [5] " note = {R package version 1.42},"
#> [6] " url = {https://yihui.org/knitr/},"
#> [7] "}"
#> [8] ""
#> [9] "@Book{knitr2015,"
#> [10] " title = {Dynamic Documents with {R} and knitr},"
#> [11] " author = {Yihui Xie},"
#> [12] " publisher = {Chapman and Hall/CRC},"
#> [13] " address = {Boca Raton, Florida},"
#> [14] " year = {2015},"
#> [15] " edition = {2nd},"
#> [16] " note = {ISBN 978-1498716963},"
#> [17] " url = {https://yihui.org/knitr/},"
#> [18] "}"
#> [19] ""
#> [20] "@InCollection{knitr2014,"
#> [21] " booktitle = {Implementing Reproducible Computational Research},"
#> [22] " editor = {Victoria Stodden and Friedrich Leisch and Roger D. Peng},"
#> [23] "title = {{knitr}: A Comprehensive Tool for Reproducible Research in {R}},"
#> [24] " author = {Yihui Xie},"
#> [25] " publisher = {Chapman and Hall/CRC},"
#> [26] " year = {2014},"
#> [27] " note = {ISBN 978-1466561595},"
#> [28] "}"
#> [29] "@Manual{renv,"
#> [30] "title = {{renv}: Project Environments},"
#> [31] " author = {Kevin Ushey},"
#> [32] " year = {2023},"
#> [33] " note = {R package version 0.17.3},"
#> [34] " url = {https://rstudio.github.io/renv/},"
#> [35] "}"
bibtex::read.bib(fgrateful)
#> Xie Y (2023). _knitr: A General-Purpose Package for Dynamic Report
#> Generation in R_. R package version 1.42, <https://yihui.org/knitr/>.
#>
#> Xie Y (2015). _Dynamic Documents with R and knitr_, 2nd edition.
#> Chapman and Hall/CRC, Boca Raton, Florida. ISBN 978-1498716963,
#> <https://yihui.org/knitr/>.
#>
#> Xie Y (2014). "knitr: A Comprehensive Tool for Reproducible Research in
#> R." In Stodden V, Leisch F, Peng RD (eds.), _Implementing Reproducible
#> Computational Research_. Chapman and Hall/CRC. ISBN 978-1466561595.
#>
#> Ushey K (2023). _renv: Project Environments_. R package version 0.17.3,
#> <https://rstudio.github.io/renv/>.
# With cffr you can add references to that
cffr::write_bib(tobib, file = fgrateful, append = TRUE)
#> ℹ Creating a backup of '/tmp/RtmpuhBdXk/grateful-refs.bib' in '/tmp/RtmpuhBdXk/grateful-refs.bib.bk1'
#> ℹ Writing 1 BibTeX entry ...
#> ✔ Results written to '/tmp/RtmpuhBdXk/grateful-refs.bib'
# And now we have added a citation from a CITATION.cff file
readLines(fgrateful)
#> [1] "@Manual{knitr2023,"
#> [2] "title = {{knitr}: A General-Purpose Package for Dynamic Report Generation in R},"
#> [3] " author = {Yihui Xie},"
#> [4] " year = {2023},"
#> [5] " note = {R package version 1.42},"
#> [6] " url = {https://yihui.org/knitr/},"
#> [7] "}"
#> [8] ""
#> [9] "@Book{knitr2015,"
#> [10] " title = {Dynamic Documents with {R} and knitr},"
#> [11] " author = {Yihui Xie},"
#> [12] " publisher = {Chapman and Hall/CRC},"
#> [13] " address = {Boca Raton, Florida},"
#> [14] " year = {2015},"
#> [15] " edition = {2nd},"
#> [16] " note = {ISBN 978-1498716963},"
#> [17] " url = {https://yihui.org/knitr/},"
#> [18] "}"
#> [19] ""
#> [20] "@InCollection{knitr2014,"
#> [21] " booktitle = {Implementing Reproducible Computational Research},"
#> [22] " editor = {Victoria Stodden and Friedrich Leisch and Roger D. Peng},"
#> [23] "title = {{knitr}: A Comprehensive Tool for Reproducible Research in {R}},"
#> [24] " author = {Yihui Xie},"
#> [25] " publisher = {Chapman and Hall/CRC},"
#> [26] " year = {2014},"
#> [27] " note = {ISBN 978-1466561595},"
#> [28] "}"
#> [29] "@Manual{renv,"
#> [30] "title = {{renv}: Project Environments},"
#> [31] " author = {Kevin Ushey},"
#> [32] " year = {2023},"
#> [33] " note = {R package version 0.17.3},"
#> [34] " url = {https://rstudio.github.io/renv/},"
#> [35] "}"
#> [36] "@Proceedings{rampinfreire:2016,"
#> [37] " title = {ReproZip: Computational Reproducibility With Ease},"
#> [38] " author = {Remi Rampin and Juliana Freire and Fernando Chirigati and Dennis Shasha},"
#> [39] " year = {2016},"
#> [40] " month = {jun},"
#> [41] " address = {San Francisco, US},"
#> [42] " series = {SIGMOD '16},"
#> [43] " doi = {10.1145/2882903.2899401},"
#> [44] " abstract = {We present ReproZip, the recommended packaging tool for the SIGMOD Reproducibility Review. ReproZip was designed to simplify the process of making an existing computational experiment reproducible across platforms, even when the experiment was put together without reproducibility in mind. The tool creates a self-contained package for an experiment by automatically tracking and identifying all its required dependencies. The researcher can share the package with others, who can then use ReproZip to unpack the experiment, reproduce the findings on their favorite operating system, as well as modify the original experiment for reuse in new research, all with little effort. The demo will consist of examples of non-trivial experiments, showing how these can be packed in a Linux machine and reproduced on different machines and operating systems. Demo visitors will also be able to pack and reproduce their own experiments.},"
#> [45] " date = {2016-06-26},"
#> [46] "}"
bibtex::read.bib(fgrateful)
#> Xie Y (2023). _knitr: A General-Purpose Package for Dynamic Report
#> Generation in R_. R package version 1.42, <https://yihui.org/knitr/>.
#>
#> Xie Y (2015). _Dynamic Documents with R and knitr_, 2nd edition.
#> Chapman and Hall/CRC, Boca Raton, Florida. ISBN 978-1498716963,
#> <https://yihui.org/knitr/>.
#>
#> Xie Y (2014). "knitr: A Comprehensive Tool for Reproducible Research in
#> R." In Stodden V, Leisch F, Peng RD (eds.), _Implementing Reproducible
#> Computational Research_. Chapman and Hall/CRC. ISBN 978-1466561595.
#>
#> Ushey K (2023). _renv: Project Environments_. R package version 0.17.3,
#> <https://rstudio.github.io/renv/>.
#>
#> Anonymous (ed.) (2016). _ReproZip: Computational Reproducibility With
#> Ease_, series SIGMOD '16. doi:10.1145/2882903.2899401
#> <https://doi.org/10.1145/2882903.2899401>.
Created on 2023-04-26 with reprex v2.0.2
A declarative, efficient, and flexible JavaScript library for building user interfaces.
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google ❤️ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.