Skip to content

Commit

Permalink
Tweaks to prepare for rhub checks.
Browse files Browse the repository at this point in the history
  • Loading branch information
davidski committed Jul 5, 2021
1 parent c865c4c commit 079a491
Show file tree
Hide file tree
Showing 6 changed files with 34 additions and 17 deletions.
5 changes: 5 additions & 0 deletions NEWS.md
Original file line number Diff line number Diff line change
@@ -1,3 +1,8 @@
# evaluator 0.4.3 (unreleased)

* Internal updates for deprecated `readr` options.
* Internal shift to roxygen 7.1.1.

# evaluator 0.4.2

* Internal updates for recent `tibble` and `tidyr` changes.
Expand Down
8 changes: 4 additions & 4 deletions R/common_graphs.R
Original file line number Diff line number Diff line change
Expand Up @@ -54,10 +54,10 @@ theme_evaluator <- function(base_family = "BentonSansRE") {
#' data(mc_domain_summary)
#' generate_heatmap(mc_domain_summary)
generate_heatmap <- function(domain_summary) {
dat <- domain_summary %>% dplyr::arrange(.data$domain_id) %>%
dplyr::mutate(full_label = paste0(.data$domain_id, "\n",
"$", round(.data$ale_var/10^6), "M"),
aux = seq(1, 2 * nrow(.), by = 2))
dat <- domain_summary %>% dplyr::arrange(.data$domain_id)
dat <- dat %>% dplyr::mutate(full_label = paste0(
.data$domain_id, "\n", "$", round(.data$ale_var/10^6), "M"),
aux = seq(1, 2 * nrow(dat), by = 2))
gg <- ggplot(dat, aes(x = .data$aux, y = 1))
gg <- gg + geom_tile(stat = "identity", color = "white",
aes(fill = .data$ale_var), width = 1)
Expand Down
22 changes: 11 additions & 11 deletions R/encode.R
Original file line number Diff line number Diff line change
Expand Up @@ -33,9 +33,9 @@ encode_scenarios <- function(scenarios, capabilities, mappings) {
# fetch TEF params
tef_nested <- dplyr::filter(mappings, .data$type == "tef") %>%
dplyr::rowwise() %>%
dplyr::do(tef_params = list(min = .$l, mode = .$ml, max = .$h,
shape = .$conf, func = "mc2d::rpert"),
label = .$label) %>%
dplyr::do(tef_params = list(min = .data$l, mode = .data$ml, max = .data$h,
shape = .data$conf, func = "mc2d::rpert"),
label = .data$label) %>%
dplyr::mutate(label = as.character(.data$label))
scenarios <- dplyr::left_join(scenarios, tef_nested,
by = c("tef" = "label")) %>%
Expand All @@ -44,9 +44,9 @@ encode_scenarios <- function(scenarios, capabilities, mappings) {
# fetch TC params
tc_nested <- dplyr::filter(mappings, .data$type == "tc") %>%
dplyr::rowwise() %>%
dplyr::do(tc_params = list(min = .$l, mode = .$ml, max = .$h,
shape = .$conf, func = "mc2d::rpert"),
label = .$label) %>%
dplyr::do(tc_params = list(min = .data$l, mode = .data$ml, max = .data$h,
shape = .data$conf, func = "mc2d::rpert"),
label = .data$label) %>%
dplyr::mutate(label = as.character(.data$label))
scenarios <- dplyr::left_join(scenarios, tc_nested,
by = c("tc" = "label")) %>%
Expand All @@ -55,9 +55,9 @@ encode_scenarios <- function(scenarios, capabilities, mappings) {
# fetch LM params
lm_nested <- dplyr::filter(mappings, .data$type == "lm") %>%
dplyr::rowwise() %>%
dplyr::do(lm_params = list(min = .$l, mode = .$ml, max = .$h,
shape = .$conf, func = "mc2d::rpert"),
label = .$label) %>%
dplyr::do(lm_params = list(min = .data$l, mode = .data$ml, max = .data$h,
shape = .data$conf, func = "mc2d::rpert"),
label = .data$label) %>%
dplyr::mutate(label = as.character(.data$label))
scenarios <- dplyr::left_join(scenarios, lm_nested,
by = c("lm" = "label")) %>%
Expand Down Expand Up @@ -145,8 +145,8 @@ derive_controls <- function(capability_ids, capabilities, mappings) {
dplyr::left_join(mappings[mappings$type == "diff", ],
by = c(label = "label")) %>%
dplyr::rowwise() %>%
dplyr::do(diff_params = list(min = .$l, mode = .$ml, max = .$h,
shape = .$conf, func = "mc2d::rpert")) %>%
dplyr::do(diff_params = list(min = .data$l, mode = .data$ml, max = .data$h,
shape = .data$conf, func = "mc2d::rpert")) %>%
dplyr::pull() %>%
rlang::set_names(nm = control_list$control_id)

Expand Down
8 changes: 8 additions & 0 deletions R/evaluator-deprecated.R
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
#' @title Deprecated functions in package \pkg{evaluator}.
#' @description The functions listed below are deprecated and will be defunct in
#' the near future. When possible, alternative functions with similar
#' functionality are also mentioned. Help pages for deprecated functions are
#' available at \code{help("<function>-deprecated")}.
#' @name evaluator-deprecated
#' @keywords internal
NULL
4 changes: 4 additions & 0 deletions R/evaluator-package.R
Original file line number Diff line number Diff line change
Expand Up @@ -6,3 +6,7 @@
## usethis namespace: start
## usethis namespace: end
NULL

## quiets concerns of R CMD check re: the .'s that appear in pipelines
## technique from Jenny Bryan's googlesheet package
utils::globalVariables(c("."))
4 changes: 2 additions & 2 deletions R/import.R
Original file line number Diff line number Diff line change
Expand Up @@ -32,8 +32,8 @@ import_spreadsheet <- function(survey_file = system.file("survey",
domains = domains)

## ----write_files---------------------------------------------------------
readr::write_csv(capabilities, path = file.path(output_dir, "capabilities.csv"))
readr::write_csv(qualitative_scenarios, path =
readr::write_csv(capabilities, file = file.path(output_dir, "capabilities.csv"))
readr::write_csv(qualitative_scenarios, file =
file.path(output_dir, "qualitative_scenarios.csv"))

file.info(c(file.path(output_dir, "capabilities.csv"),
Expand Down

0 comments on commit 079a491

Please sign in to comment.