Skip to content

Commit

Permalink
add 'add_editor_airtable_data' fn for #7
Browse files Browse the repository at this point in the history
  • Loading branch information
mpadge committed Mar 19, 2024
1 parent bc0a3fe commit de8a30e
Show file tree
Hide file tree
Showing 5 changed files with 50 additions and 2 deletions.
2 changes: 1 addition & 1 deletion DESCRIPTION
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
Package: dashboard
Title: What the Package Does (One Line, Title Case)
Version: 0.0.7.003
Version: 0.0.7.004
Authors@R:
person(given = "First",
family = "Last",
Expand Down
1 change: 1 addition & 0 deletions NAMESPACE
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
# Generated by roxygen2: do not edit by hand

export(add_editor_airtable_data)
export(editor_status)
export(editor_vacation_status)
export(review_status)
29 changes: 29 additions & 0 deletions R/editors-airtable.R
Original file line number Diff line number Diff line change
Expand Up @@ -32,3 +32,32 @@ editor_vacation_status <- function () {
editors_on_vacation <- edvac$github [which (edvac$away)]
ed_status$status [ed_status$editor %in% editors_on_vacation] <- "ON LEAVE"
}

#' Add additional columns to 'editors' data from rOpenSci's airtable database.
#'
#' @param editors The `data.frame` of editors returned as the "status" component
#' from \link{editor_status}.
#' @return A modified version of `editors` with additional columns.
#' @export
add_editor_airtable_data <- function (editors) {
rev_prod <- airtabler::airtable (
base = "app8dssb6a7PG6Vwj", table = "reviewers-prod"
)
fields <- list ("github", "name", "other_langs", "domain_expertise")
rev_prod <- rev_prod$`reviewers-prod`$select_all (fields = fields)

editors$other_langs <- editors$domain_expertise <- NA_character_
index <- match (editors$editor, rev_prod$github)

editors$other_langs <- rev_prod$other_langs [index]
editors$other_langs <- vapply (editors$other_langs, function (i) {
paste0 (i [which (!i == "English")], collapse = ", ")
}, character (1L))

editors$domain_expertise <- rev_prod$domain_expertise [index]
editors$domain_expertise <- vapply (editors$domain_expertise, function (i) {
paste0 (i [which (!grepl ("^Other", i))], collapse = ", ")
}, character (1L))

return (editors)
}
2 changes: 1 addition & 1 deletion codemeta.json
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@
"name": "dashboard: What the Package Does (One Line, Title Case)",
"codeRepository": "https://github.com/ropensci-review-tools/dashboard",
"license": "https://spdx.org/licenses/MIT",
"version": "0.0.7.003",
"version": "0.0.7.004",
"programmingLanguage": {
"@type": "ComputerLanguage",
"name": "R",
Expand Down
18 changes: 18 additions & 0 deletions man/add_editor_airtable_data.Rd

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

0 comments on commit de8a30e

Please sign in to comment.