Skip to content

Commit f049f47

Browse files
a function to extract author emails of an issue
1 parent ba6349e commit f049f47

File tree

3 files changed

+45
-0
lines changed

3 files changed

+45
-0
lines changed

NAMESPACE

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -35,6 +35,7 @@ export(ae_workload)
3535
export(agree_reviewer)
3636
export(article)
3737
export(as.article)
38+
export(author_emails)
3839
export(build_issue)
3940
export(build_latex)
4041
export(corr_author)

R/author-email.R

Lines changed: 24 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,24 @@
1+
#' Extract email from leading author of an issue for emailing
2+
#'
3+
#' If the email of leading author is not available, the first author with
4+
#' available email will be used.
5+
#'
6+
#' @param issue the issue number in the `Proofs` folder, i.e. "2021-2"
7+
#'
8+
#' @export
9+
#' @examples
10+
#' \dontrun{
11+
#' author_emails("2021-2")
12+
#' }
13+
author_emails <- function(issue){
14+
15+
id <- dir(rj:::issue_dir(issue), pattern = "\\d{4}-\\d{2}", full.names = TRUE)
16+
17+
dt <- purrr::map(id, function(x){
18+
desc <- rj:::load_article(file.path(x, "DESCRIPTION"))
19+
Filter(function(x)!is.null(x$email), desc$authors)[[1]]
20+
})
21+
22+
out <- purrr::map_dfr(dt, ~tibble(name = .x$name, email = .x$email))
23+
out
24+
}

man/author_emails.Rd

Lines changed: 20 additions & 0 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

0 commit comments

Comments
 (0)