Skip to content

Commit 11ce0dc

Browse files
committed
Standardize upon tibble::tibble over dplyr::data_frame calls.
1 parent e4810ce commit 11ce0dc

File tree

5 files changed

+11
-9
lines changed

5 files changed

+11
-9
lines changed

NAMESPACE

+1-1
Original file line numberDiff line numberDiff line change
@@ -43,7 +43,6 @@ importFrom(dplyr,arrange)
4343
importFrom(dplyr,arrange_)
4444
importFrom(dplyr,bind_rows)
4545
importFrom(dplyr,case_when)
46-
importFrom(dplyr,data_frame)
4746
importFrom(dplyr,filter)
4847
importFrom(dplyr,filter_)
4948
importFrom(dplyr,funs)
@@ -100,6 +99,7 @@ importFrom(scales,percent)
10099
importFrom(stats,quantile)
101100
importFrom(stats,sd)
102101
importFrom(stringi,stri_split_fixed)
102+
importFrom(tibble,add_row)
103103
importFrom(tibble,as_tibble)
104104
importFrom(tibble,rownames_to_column)
105105
importFrom(tibble,tibble)

R/load_data.R

+2-2
Original file line numberDiff line numberDiff line change
@@ -6,8 +6,8 @@
66
#' Preexisting files, if present, will not be overwritten. Also creates an
77
#' empty `results` subdirectory as a default location for evaluator output.
88
#'
9-
#' @importFrom dplyr data_frame
109
#' @importFrom purrr map_dfr
10+
#' @importFrom tibble add_row tibble
1111
#' @param base_directory Parent directory under which to create starter files.
1212
#' @export
1313
#' @return A dataframe of the starter filenames, along with a flag on whether a file was copied.
@@ -26,7 +26,7 @@ create_templates <- function(base_directory = "~/evaluator"){
2626
# copy all the standard CSV files
2727
res <- c("domains.csv", "qualitative_mappings.csv", "risk_tolerances.csv") %>%
2828
purrr::map_dfr(
29-
~ dplyr::data_frame(filename = .x,
29+
~ tibble::tibble(filename = .x,
3030
copied = file.copy(system.file("extdata", .x,
3131
package = "evaluator"),
3232
inputs_dir)))

R/utils.R

+2-2
Original file line numberDiff line numberDiff line change
@@ -13,8 +13,8 @@
1313
#' }
1414
check_availability <- function(packages, func) {
1515
res <- purrr::map_df(packages,
16-
~ tibble(package = .x,
17-
available = requireNamespace(.x, quietly=TRUE)))
16+
~ tibble::tibble(package = .x,
17+
available = requireNamespace(.x, quietly=TRUE)))
1818
if (sum(res$available) != length(packages)) {
1919
stop(func, " requires the following packages which are not available: ",
2020
paste0(res[, ]$package, collapse = ", "), "\n",

inst/rmd/analyze_risk.Rmd

+4-3
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
---
2-
title: "Strategic Information Security Risk Analysis"
3-
author: "Evaluator toolkit (https://github.com/davidski/evaluator)"
2+
title: "Strategic Information Risk Analysis"
3+
author: "Evaluator toolkit (https://evaluator.severski.net)"
44
output:
55
html_document:
66
css: "html-styles.css"
@@ -55,6 +55,7 @@ library(rlang)
5555
library(psych)
5656
library(tidyr)
5757
library(pander)
58+
library(tibble)
5859
library(evaluator)
5960
6061
panderOptions('table.split.table', Inf) # allow pander to make pages wide
@@ -145,7 +146,7 @@ mean, and minimum annual losses.
145146
overall <- simulation_results %>% group_by(simulation) %>%
146147
summarize(ale = sum(ale)) %>% select(ale) %>%
147148
ungroup
148-
data_frame("Value at Risk" = dollar(quantile(overall$ale, c(0.95))),
149+
tibble::tibble("Value at Risk" = dollar(quantile(overall$ale, c(0.95))),
149150
"Maximum Loss" = dollar(max(overall$ale)),
150151
"Mean Loss" = dollar(mean(overall$ale)),
151152
"Minimum Loss" = dollar(min(overall$ale))

inst/rmd/explore_scenarios.Rmd

+2-1
Original file line numberDiff line numberDiff line change
@@ -24,6 +24,7 @@ library(scales)
2424
library(viridis)
2525
library(ggplot2)
2626
library(dplyr)
27+
library(tibble)
2728
library(evaluator)
2829
library(extrafont)
2930
input_directory <- params$input_directory
@@ -59,7 +60,7 @@ custom_percent <- function(x) {
5960
6061
get_loss_table <- function(tid) {
6162
scenario_data <- simulation_results[simulation_results$scenario_id == tid, ]
62-
loss_table <- tibble::data_frame(Category = c("Loss Events / Year", "Loss Magnitude",
63+
loss_table <- tibble::tibble(Category = c("Loss Events / Year", "Loss Magnitude",
6364
"Total Loss Exposure"),
6465
Minimum = c(min(scenario_data$loss_events),
6566
min(scenario_data$sle_min) %>% dollar,

0 commit comments

Comments
 (0)