diff --git a/R/RcppExports.R b/R/RcppExports.R index b94b3d4..3375c42 100644 --- a/R/RcppExports.R +++ b/R/RcppExports.R @@ -1,19 +1,41 @@ # Generated by using Rcpp::compileAttributes() -> do not edit by hand # Generator token: 10BE3573-1514-4C36-9D1C-5A225CD40393 -glicko <- function(unique_id, id, rank, team, player, r, rd, sigma, share, lambda, weight, init_r, init_rd, init_sigma, kappa, tau) { - .Call('_sport_glicko', PACKAGE = 'sport', unique_id, id, rank, team, player, r, rd, sigma, share, lambda, weight, init_r, init_rd, init_sigma, kappa, tau) +glicko <- function( + unique_id, id, rank, team, player, r, rd, sigma, share, lambda, weight, init_r, init_rd, init_sigma, kappa, tau) { + .Call( + "_sport_glicko", + PACKAGE = "sport", + unique_id, id, rank, team, player, r, rd, sigma, share, lambda, weight, + init_r, init_rd, init_sigma, kappa, tau + ) } -glicko2 <- function(unique_id, id, rank, team, player, r, rd, sigma, share, lambda, weight, init_r, init_rd, init_sigma, kappa, tau) { - .Call('_sport_glicko2', PACKAGE = 'sport', unique_id, id, rank, team, player, r, rd, sigma, share, lambda, weight, init_r, init_rd, init_sigma, kappa, tau) +glicko2 <- function( + unique_id, id, rank, team, player, r, rd, sigma, share, lambda, weight, init_r, init_rd, init_sigma, kappa, tau) { + .Call( + "_sport_glicko2", + PACKAGE = "sport", + unique_id, id, rank, team, player, r, rd, sigma, share, lambda, weight, + init_r, init_rd, init_sigma, kappa, tau + ) } -bbt <- function(unique_id, id, rank, team, player, r, rd, sigma, share, lambda, weight, init_r, init_rd, init_sigma, kappa, tau) { - .Call('_sport_bbt', PACKAGE = 'sport', unique_id, id, rank, team, player, r, rd, sigma, share, lambda, weight, init_r, init_rd, init_sigma, kappa, tau) +bbt <- function( + unique_id, id, rank, team, player, r, rd, sigma, share, lambda, weight, init_r, init_rd, init_sigma, kappa, tau) { + .Call( + "_sport_bbt", + PACKAGE = "sport", + unique_id, id, rank, team, player, r, rd, sigma, share, lambda, + weight, init_r, init_rd, init_sigma, kappa, tau + ) } -dbl <- function(unique_id, id_vec, rank_vec, team_vec, MAP, X, cls, R, RD, lambda_vec, weight_vec, kappa) { - .Call('_sport_dbl', PACKAGE = 'sport', unique_id, id_vec, rank_vec, team_vec, MAP, X, cls, R, RD, lambda_vec, weight_vec, kappa) +dbl <- function( + unique_id, id_vec, rank_vec, team_vec, MAP, X, cls, R, RD, lambda_vec, weight_vec, kappa) { + .Call( + "_sport_dbl", + PACKAGE = "sport", + unique_id, id_vec, rank_vec, team_vec, MAP, X, cls, R, RD, lambda_vec, weight_vec, kappa + ) } - diff --git a/R/data.R b/R/data.R index db9a886..60acedd 100755 --- a/R/data.R +++ b/R/data.R @@ -21,7 +21,6 @@ #' @name gpheats NULL - #' Turnament results of Speedway Grand-Prix #' #' Actual dataset containing turnament results of all Speedway Grand-Prix events diff --git a/R/utils.R b/R/utils.R index 46bcab2..0622ced 100755 --- a/R/utils.R +++ b/R/utils.R @@ -19,7 +19,6 @@ is_newdata_consistent <- function(vars, newnames) { are_variables_in_dataset <- function(vars, data) { missing_vars <- setdiff(vars, colnames(data)) - if (length(missing_vars) > 0) { stop( sprintf( @@ -32,6 +31,7 @@ are_variables_in_dataset <- function(vars, data) { return(invisible(TRUE)) } + check_numeric_argument <- function(x, var_name, min = -Inf, max = Inf) { if (!is.numeric(x)) { stop(sprintf("Variable %s should be of type numeric.", var_name), @@ -50,15 +50,18 @@ check_numeric_argument <- function(x, var_name, min = -Inf, max = Inf) { check_integer_argument <- function(x, var_name, min = -Inf, max = Inf) { if (!is.integer(x)) { - stop(sprintf("Variable %s should be of type integer.", var_name), + stop( + sprintf("Variable %s should be of type integer.", var_name), call. = FALSE ) } else if (any(!is.finite(x))) { - stop(sprintf("Variable %s contains non-finite values. All elements should be finite.", var_name), + stop( + sprintf("Variable %s contains non-finite values. All elements should be finite.", var_name), call. = FALSE ) } else if (any(x < min | x > max)) { - stop(sprintf("All values in variable %s should be in range [%s, %s]", var_name, min, max), + stop( + sprintf("All values in variable %s should be in range [%s, %s]", var_name, min, max), call. = FALSE ) } @@ -78,15 +81,18 @@ check_string_argument <- function(x, var_name) { check_single_argument <- function(x, var_name, min = -Inf, max = Inf) { if (length(x) > 1) { - stop(sprintf("variable %s should be a single value", var_name), + stop( + sprintf("variable %s should be a single value", var_name), call. = FALSE ) } else if (is.numeric(x) && x < min) { - stop(sprintf("variable %s should be greater than %s", var_name, min), + stop( + sprintf("variable %s should be greater than %s", var_name, min), call. = FALSE ) } else if (is.numeric(x) && x > max) { - stop(sprintf("variable %s should be lower than %s", var_name, max), + stop( + sprintf("variable %s should be lower than %s", var_name, max), call. = FALSE ) }