@@ -7,38 +7,53 @@ citHeader(
77 )
88)
99
10- year <- format(Sys.Date(), "%Y")
10+ authors <- eval(parse(text = meta$`Authors@R`))
11+
12+ year <- if (!is.null(meta$Date)) {
13+ sub("-.*", "", meta$Date)
14+ } else {
15+ format(Sys.Date(), "%Y")
16+ }
17+
1118note <- sprintf("R package version %s", meta$Version)
12- url <- "https://CRAN.R-project.org/package=inti"
1319
14- authors <- eval(parse(text = meta$`Authors@R`))
20+ url <- "https://CRAN.R-project.org/package=inti"
1521
1622bibentry(
23+ key = "inti",
1724 bibtype = "Manual",
18- title = "{ inti} : Tools and Statistical Procedures in Plant Science",
25+ title = "inti: Tools and Statistical Procedures in Plant Science",
1926 author = authors,
2027 year = year,
2128 note = note,
2229 url = url
2330)
2431
25- authors_text <- paste(
26- vapply(
27- authors,
28- function(x) {
29- paste0(x$family, ", ", substr(x$given, 1, 1), ".")
30- },
31- character(1)
32- ),
33- collapse = ", "
32+ authors_vec <- vapply(
33+ authors,
34+ function(x) {
35+ paste0(x$family, ", ", substr(x$given, 1, 1), ".")
36+ },
37+ character(1)
3438)
3539
40+ authors_text <- if (length(authors_vec) == 1) {
41+ authors_vec
42+ } else if (length(authors_vec) == 2) {
43+ paste(authors_vec, collapse = " & ")
44+ } else {
45+ paste0(
46+ paste(authors_vec[-length(authors_vec)], collapse = ", "),
47+ ", & ",
48+ authors_vec[length(authors_vec)]
49+ )
50+ }
51+
3652textVersion <- paste0(
3753 authors_text,
3854 " (", year, "). ",
3955 "inti: Tools and Statistical Procedures in Plant Science. ",
4056 note,
41- ". ",
57+ ". Retrieved from ",
4258 url
43- )
44-
59+ )
0 commit comments