From 2689bdb8e57362ab0b67b65c44a252c9baf20995 Mon Sep 17 00:00:00 2001 From: simonpcouch Date: Mon, 22 Apr 2024 13:38:58 -0500 Subject: [PATCH] tidy style: remove unneeded spaces --- R/container.R | 2 +- R/equivocal_zone.R | 4 ++-- R/numeric_range.R | 4 ++-- R/prob_threshold.R | 8 ++++---- 4 files changed, 9 insertions(+), 9 deletions(-) diff --git a/R/container.R b/R/container.R index c8c720d..56f6938 100644 --- a/R/container.R +++ b/R/container.R @@ -116,7 +116,7 @@ fit.container <- function(object, .data, outcome, estimate, probabilities = c(), - object <- set_container_type(object, .data[[ dat$outcome ]]) + object <- set_container_type(object, .data[[dat$outcome]]) object <- new_container(object$mode, object$type, operations = object$operations, diff --git a/R/equivocal_zone.R b/R/equivocal_zone.R index 1f7a44d..9575656 100644 --- a/R/equivocal_zone.R +++ b/R/equivocal_zone.R @@ -80,12 +80,12 @@ fit.equivocal_zone <- function(object, data, parent = NULL, ...) { predict.equivocal_zone <- function(object, new_data, parent, ...) { est_nm <- parent$columns$estimate prob_nm <- parent$columns$probabilities[1] - lvls <- levels(new_data[[ est_nm ]]) + lvls <- levels(new_data[[est_nm]]) col_syms <- syms(prob_nm[1]) cls_pred <- probably::make_two_class_pred(new_data[[prob_nm]], levels = lvls, buffer = object$arguments$value, threshold = object$arguments$threshold) - new_data[[ est_nm ]] <- cls_pred # todo convert to factor? + new_data[[est_nm]] <- cls_pred # todo convert to factor? new_data } diff --git a/R/numeric_range.R b/R/numeric_range.R index 1b37f8c..96441d5 100644 --- a/R/numeric_range.R +++ b/R/numeric_range.R @@ -75,8 +75,8 @@ predict.numeric_range <- function(object, new_data, parent, ...) { hi <- object$arguments$upper_limit # todo depends on tm predict col names - new_data[[ est_nm ]] <- - probably::bound_prediction(new_data, lower_limit = lo, upper_limit = hi)[[ est_nm ]] + new_data[[est_nm]] <- + probably::bound_prediction(new_data, lower_limit = lo, upper_limit = hi)[[est_nm]] new_data } diff --git a/R/prob_threshold.R b/R/prob_threshold.R index 6109781..3ee6cd7 100644 --- a/R/prob_threshold.R +++ b/R/prob_threshold.R @@ -76,11 +76,11 @@ fit.probability_threshold <- function(object, data, parent = NULL, ...) { predict.probability_threshold <- function(object, new_data, parent, ...) { est_nm <- parent$columns$estimate prob_nm <- parent$columns$probabilities[1] - lvls <- levels(new_data[[ est_nm ]]) + lvls <- levels(new_data[[est_nm]]) - new_data[[ est_nm ]] <- - ifelse(new_data[[ prob_nm ]] >= object$arguments$threshold, lvls[1], lvls[2]) - new_data[[ est_nm ]] <- factor(new_data[[ est_nm ]], levels = lvls) + new_data[[est_nm]] <- + ifelse(new_data[[prob_nm]] >= object$arguments$threshold, lvls[1], lvls[2]) + new_data[[est_nm]] <- factor(new_data[[est_nm]], levels = lvls) new_data }