-
-
Notifications
You must be signed in to change notification settings - Fork 3
Expand file tree
/
Copy pathCITATION
More file actions
59 lines (51 loc) · 1.15 KB
/
Copy pathCITATION
File metadata and controls
59 lines (51 loc) · 1.15 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
citHeader(
paste(
"If you are using inti in your work,",
"we encourage you to cite the package.",
"\n\n",
"To cite inti in publications, please use:"
)
)
authors <- eval(parse(text = meta$`Authors@R`))
year <- if (!is.null(meta$Date)) {
sub("-.*", "", meta$Date)
} else {
format(Sys.Date(), "%Y")
}
note <- sprintf("R package version %s", meta$Version)
url <- "https://CRAN.R-project.org/package=inti"
bibentry(
key = "inti",
bibtype = "Manual",
title = "inti: Tools and Statistical Procedures in Plant Science",
author = authors,
year = year,
note = note,
url = url
)
authors_vec <- vapply(
authors,
function(x) {
paste0(x$family, ", ", substr(x$given, 1, 1), ".")
},
character(1)
)
authors_text <- if (length(authors_vec) == 1) {
authors_vec
} else if (length(authors_vec) == 2) {
paste(authors_vec, collapse = " & ")
} else {
paste0(
paste(authors_vec[-length(authors_vec)], collapse = ", "),
", & ",
authors_vec[length(authors_vec)]
)
}
textVersion <- paste0(
authors_text,
" (", year, "). ",
"inti: Tools and Statistical Procedures in Plant Science. ",
note,
". Retrieved from ",
url
)