From 079a4918b32ecd77515c18a8f278dd00acbd2994 Mon Sep 17 00:00:00 2001 From: "David F. Severski" Date: Mon, 5 Jul 2021 13:41:21 -0700 Subject: [PATCH] Tweaks to prepare for rhub checks. --- NEWS.md | 5 +++++ R/common_graphs.R | 8 ++++---- R/encode.R | 22 +++++++++++----------- R/evaluator-deprecated.R | 8 ++++++++ R/evaluator-package.R | 4 ++++ R/import.R | 4 ++-- 6 files changed, 34 insertions(+), 17 deletions(-) create mode 100644 R/evaluator-deprecated.R diff --git a/NEWS.md b/NEWS.md index 62773c9..3980585 100644 --- a/NEWS.md +++ b/NEWS.md @@ -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. diff --git a/R/common_graphs.R b/R/common_graphs.R index 04c0fc4..2ae997a 100644 --- a/R/common_graphs.R +++ b/R/common_graphs.R @@ -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) diff --git a/R/encode.R b/R/encode.R index d6ecdfb..a32ff70 100644 --- a/R/encode.R +++ b/R/encode.R @@ -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")) %>% @@ -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")) %>% @@ -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")) %>% @@ -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) diff --git a/R/evaluator-deprecated.R b/R/evaluator-deprecated.R new file mode 100644 index 0000000..d80aebf --- /dev/null +++ b/R/evaluator-deprecated.R @@ -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("-deprecated")}. +#' @name evaluator-deprecated +#' @keywords internal +NULL diff --git a/R/evaluator-package.R b/R/evaluator-package.R index b30bbda..450a6ae 100644 --- a/R/evaluator-package.R +++ b/R/evaluator-package.R @@ -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(".")) diff --git a/R/import.R b/R/import.R index edccbbb..26f0829 100644 --- a/R/import.R +++ b/R/import.R @@ -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"),