Skip to content

Commit

Permalink
Add input checks to plot_forecast_counts()
Browse files Browse the repository at this point in the history
  • Loading branch information
nikosbosse committed Dec 6, 2023
1 parent 8c65056 commit 1463221
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 0 deletions.
1 change: 1 addition & 0 deletions NAMESPACE
Original file line number Diff line number Diff line change
Expand Up @@ -86,6 +86,7 @@ importFrom(checkmate,assert_list)
importFrom(checkmate,assert_logical)
importFrom(checkmate,assert_number)
importFrom(checkmate,assert_numeric)
importFrom(checkmate,assert_string)
importFrom(checkmate,assert_vector)
importFrom(checkmate,check_atomic_vector)
importFrom(checkmate,check_data_frame)
Expand Down
5 changes: 5 additions & 0 deletions R/plot.R
Original file line number Diff line number Diff line change
Expand Up @@ -957,6 +957,7 @@ plot_pit <- function(pit,
#' @importFrom ggplot2 ggplot scale_colour_manual scale_fill_manual
#' geom_tile scale_fill_gradient .data
#' @importFrom data.table dcast .I .N
#' @importFrom checkmate assert_string assert_logical
#' @export
#' @examples
#' library(ggplot2)
Expand All @@ -975,6 +976,10 @@ plot_forecast_counts <- function(forecast_counts,
show_numbers = TRUE) {

forecast_counts <- ensure_data.table(forecast_counts)
assert_string(y)
assert_string(x)
assert_logical(make_x_factor)
assert_logical(show_numbers)

if (make_x_factor) {
forecast_counts[, eval(x) := as.factor(get(x))]
Expand Down

0 comments on commit 1463221

Please sign in to comment.