epiforecasts / scoringutils

Utilities for Scoring and Assessing Predictions
https://epiforecasts.io/scoringutils/
Other
48 stars 20 forks source link

Issue ##438 - Add tests to check existing data.table functions work with data.frames #799

Closed nikosbosse closed 3 months ago

nikosbosse commented 4 months ago

Description

This PR closes #438.

This PR adds additional tests to make sure that all exported functions that accept a data.table also work with a data.frame. I simply went through a list of the functions and added tests.

I got the list of functions to check as such (thanks, GPT):

exported_functions <- ls("package:scoringutils")
functions_with_data_arg <- character(0) 
for (func_name in exported_functions) {
  func_args <- suppressWarnings(formals(get(func_name)))
  if (!is.null(names(func_args)) && names(func_args)[1] == "data") {
    functions_with_data_arg <- c(functions_with_data_arg, func_name)
  }
}
functions_with_data_arg

Checklist