Skip to content

Commit

Permalink
rename to follow naming convention
Browse files Browse the repository at this point in the history
  • Loading branch information
hfrick committed Sep 19, 2024
1 parent 9ea5dbc commit 8f57e0c
Show file tree
Hide file tree
Showing 9 changed files with 11 additions and 11 deletions.
2 changes: 1 addition & 1 deletion R/boot.R
Original file line number Diff line number Diff line change
Expand Up @@ -76,7 +76,7 @@ bootstraps <-
if (length(strata) == 0) strata <- NULL
}

strata_check(strata, data)
check_strata(strata, data)

split_objs <-
boot_splits(
Expand Down
4 changes: 2 additions & 2 deletions R/initial_validation_split.R
Original file line number Diff line number Diff line change
Expand Up @@ -68,7 +68,7 @@ initial_validation_split <- function(data,
strata <- NULL
}
}
strata_check(strata, data)
check_strata(strata, data)

split_train <- mc_cv(
data = data,
Expand Down Expand Up @@ -209,7 +209,7 @@ group_initial_validation_split <- function(data,
strata <- NULL
}
}
strata_check(strata, data)
check_strata(strata, data)

if (missing(strata)) {
split_train <- group_mc_cv(
Expand Down
2 changes: 1 addition & 1 deletion R/mc.R
Original file line number Diff line number Diff line change
Expand Up @@ -58,7 +58,7 @@ mc_cv <- function(data, prop = 3 / 4, times = 25,
if (length(strata) == 0) strata <- NULL
}

strata_check(strata, data)
check_strata(strata, data)

split_objs <-
mc_splits(
Expand Down
2 changes: 1 addition & 1 deletion R/misc.R
Original file line number Diff line number Diff line change
Expand Up @@ -98,7 +98,7 @@ add_class <- function(x, cls) {
x
}

strata_check <- function(strata, data, call = caller_env()) {
check_strata <- function(strata, data, call = caller_env()) {
check_string(strata, allow_null = TRUE, call = call)

if (!is.null(strata)) {
Expand Down
2 changes: 1 addition & 1 deletion R/validation_split.R
Original file line number Diff line number Diff line change
Expand Up @@ -67,7 +67,7 @@ validation_split <- function(data, prop = 3 / 4,
}
}

strata_check(strata, data)
check_strata(strata, data)

split_objs <-
mc_splits(
Expand Down
2 changes: 1 addition & 1 deletion R/vfold.R
Original file line number Diff line number Diff line change
Expand Up @@ -71,7 +71,7 @@ vfold_cv <- function(data, v = 10, repeats = 1,
if (length(strata) == 0) strata <- NULL
}

strata_check(strata, data)
check_strata(strata, data)
check_repeats(repeats)

if (repeats == 1) {
Expand Down
2 changes: 1 addition & 1 deletion tests/testthat/_snaps/make_strata.md
Original file line number Diff line number Diff line change
Expand Up @@ -67,7 +67,7 @@
# don't stratify on Surv objects

Code
strata_check("surv", df)
check_strata("surv", df)
Condition
Error:
! `strata` cannot be a <Surv> object.
Expand Down
4 changes: 2 additions & 2 deletions tests/testthat/test-make_strata.R
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,7 @@ test_that("bad data", {



# strata_check() ----------------------------------------------------------
# check_strata() ----------------------------------------------------------

test_that("don't stratify on Surv objects", {
df <- data.frame(
Expand All @@ -58,6 +58,6 @@ test_that("don't stratify on Surv objects", {
)

expect_snapshot(error = TRUE, {
strata_check("surv", df)
check_strata("surv", df)
})
})
2 changes: 1 addition & 1 deletion tests/testthat/test-vfold.R
Original file line number Diff line number Diff line change
Expand Up @@ -79,7 +79,7 @@ test_that("strata arg is checked", {
vfold_cv(iris, strata = iris$Species)
})

# errors from `strata_check()`
# errors from `check_strata()`
expect_snapshot(error = TRUE, {
vfold_cv(iris, strata = c("Species", "Sepal.Width"))
})
Expand Down

0 comments on commit 8f57e0c

Please sign in to comment.