From 78f8507a831a38f3f66eb9c8f48bf45d04d4d2d5 Mon Sep 17 00:00:00 2001 From: mariusbarth Date: Thu, 20 Mar 2025 18:55:08 +0100 Subject: [PATCH 1/2] added CITATION file --- inst/CITATION | 17 +++++++++++++++++ 1 file changed, 17 insertions(+) create mode 100644 inst/CITATION diff --git a/inst/CITATION b/inst/CITATION new file mode 100644 index 0000000..b33b2ca --- /dev/null +++ b/inst/CITATION @@ -0,0 +1,17 @@ +year <- sub("-.*", "", meta$Date) +url <- "https://cran.r-project.org/package=afex" + +authors_r <-read.dcf(system.file("DESCRIPTION", package = "afex"), fields = "Authors@R") +authors <- eval(parse(text = authors_r)) +authors <- Filter(function(p) any(p$role %in% c("aut", "cre")), authors) + + +bibentry( + bibtype = "Manual" + , title = paste0("{afex}: ", meta$Title) + , author = authors + , year = year + , note = paste("R package version", meta$Version) + , url = url + , doi = "10.32614/CRAN.package.afex" +) From 2ffcc6aa22050edc978980e64ed6406b8709ff93 Mon Sep 17 00:00:00 2001 From: mariusbarth Date: Thu, 20 Mar 2025 18:59:03 +0100 Subject: [PATCH 2/2] use Sys.Date() in CITATION file if Date filed is not populated by CRAN (e.g., if building from github repo) --- inst/CITATION | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/inst/CITATION b/inst/CITATION index b33b2ca..3fdbecb 100644 --- a/inst/CITATION +++ b/inst/CITATION @@ -1,4 +1,10 @@ -year <- sub("-.*", "", meta$Date) +if(is.null(meta$Date)) { + date <- Sys.Date() +} else { + date <- meta$Date +} + +year <- sub("-.*", "", date) url <- "https://cran.r-project.org/package=afex" authors_r <-read.dcf(system.file("DESCRIPTION", package = "afex"), fields = "Authors@R")