From 92e70bf70757c16aac6df049a2c7da3a1769060c Mon Sep 17 00:00:00 2001 From: Jan Philipp Dietrich Date: Fri, 26 Jan 2018 12:29:26 +0100 Subject: [PATCH] added CITATION --- DESCRIPTION | 4 ++-- inst/CITATION | 18 ++++++++++++++++++ 2 files changed, 20 insertions(+), 2 deletions(-) create mode 100644 inst/CITATION diff --git a/DESCRIPTION b/DESCRIPTION index a0c21332..ce8da2cb 100644 --- a/DESCRIPTION +++ b/DESCRIPTION @@ -1,8 +1,8 @@ Package: magclass Type: Package Title: Data Class and Tools for Handling Spatial-Temporal Data -Version: 4.74.1 -Date: 2018-01-25 +Version: 4.75.0 +Date: 2018-01-26 Authors@R: c(person("Jan Philipp", "Dietrich", email = "dietrich@pik-potsdam.de", role = c("aut","cre")), person("Benjamin Leon", "Bodirsky", email = "bodirsky@pik-potsdam.de", role = "aut"), person("Markus", "Bonsch", role = "aut"), diff --git a/inst/CITATION b/inst/CITATION new file mode 100644 index 00000000..159771d3 --- /dev/null +++ b/inst/CITATION @@ -0,0 +1,18 @@ + + +citation_doi <- function(package) { + cit <- citation(package, auto=TRUE) + if(!is.null(cit$note)) { + tmp <- strsplit(cit$note,", ")[[1]] + urls <- grep("http",tmp,value=TRUE) + cit$note <- paste0(grep("http",tmp,value=TRUE, invert=TRUE), collapse=", ") + cit$doi <- gsub("\n","",gsub("https://doi.org/","",grep("doi.org",urls,fixed=TRUE, value=TRUE), fixed=TRUE)) + cit$url <- grep("doi.org",urls,fixed=TRUE, value=TRUE, invert=TRUE) + if(cit$note=="") cit$note <- paste("R package version",packageDescription(package)$Version) + if(!length(cit$url)) cit$url <- NULL + if(!length(cit$doi)) cit$doi <- NULL + } + return(cit) +} + +citation_doi("magclass") \ No newline at end of file