Skip to content

Commit

Permalink
0.2.7: enable citing RStudio in 'table' output #41
Browse files Browse the repository at this point in the history
  • Loading branch information
Pakillo committed May 17, 2024
1 parent cdaaa90 commit 91f8264
Show file tree
Hide file tree
Showing 5 changed files with 17 additions and 5 deletions.
4 changes: 2 additions & 2 deletions DESCRIPTION
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
Package: grateful
Title: Facilitate Citation of R Packages
Version: 0.2.6
Version: 0.2.7
Authors@R: c(
person("Francisco", "Rodriguez-Sanchez",
email = "[email protected]",
Expand Down Expand Up @@ -33,4 +33,4 @@ Suggests:
Config/testthat/edition: 3
Encoding: UTF-8
Roxygen: list(markdown = TRUE)
RoxygenNote: 7.2.3
RoxygenNote: 7.3.1
4 changes: 4 additions & 0 deletions NEWS.md
Original file line number Diff line number Diff line change
@@ -1,4 +1,8 @@

# grateful 0.2.7

* Enable citing Rstudio with 'table' output format (issue #41).

# grateful 0.2.6

* Explain how to cite R together with a given list of packages (issue #37).
Expand Down
2 changes: 1 addition & 1 deletion R/cite_packages.R
Original file line number Diff line number Diff line change
Expand Up @@ -221,7 +221,7 @@ cite_packages <- function(output = c("file", "paragraph", "table", "citekeys"),


if (output == "table") {
return(output_table(pkgs.df))
return(output_table(pkgs.df, include.RStudio = include.RStudio))
}


Expand Down
10 changes: 9 additions & 1 deletion R/output_table.R
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
output_table <- function(pkgs.df) {
output_table <- function(pkgs.df, include.RStudio = FALSE) {

pkgs.df$Citation <- lapply(pkgs.df$citekeys,
function(x) {
Expand All @@ -9,6 +9,14 @@ output_table <- function(pkgs.df) {

pkgs.df <- pkgs.df[, c("pkg", "version", "Citation")]
names(pkgs.df) <- c("Package", "Version", "Citation")

if (include.RStudio) {
rstudio <- data.frame(Package = "RStudio",
Version = as.character(rstudioapi::versionInfo()$version),
Citation = "@rstudio")
pkgs.df <- rbind(pkgs.df, rstudio)
}

return(pkgs.df)

}
2 changes: 1 addition & 1 deletion tests/testthat/test-utils_citations.R
Original file line number Diff line number Diff line change
Expand Up @@ -47,7 +47,7 @@ test_that("Test get_citation_and_citekey function", {
expect_identical(get_citation_and_citekey("grateful"),
structure(c("@Manual{grateful,",
title = "title = {{grateful}: Facilitate citation of R packages},",
author = " author = {{Francisco Rodriguez-Sanchez} and {Connor P. Jackson}},",
author = " author = {Francisco Rodriguez-Sanchez and Connor P. Jackson},",
year = " year = {2023},",
url = " url = {https://pakillo.github.io/grateful/},",
"}"),
Expand Down

0 comments on commit 91f8264

Please sign in to comment.