mirror of
https://github.com/agdamsbo/stRoke.git
synced 2024-11-24 21:51:55 +01:00
New tests with help from gpttools
This commit is contained in:
parent
0cee325112
commit
6098335cea
@ -2,4 +2,5 @@ test_that("generic_stroke() runs!", {
|
|||||||
iris$ord<-factor(sample(1:3,size=nrow(iris),replace=TRUE),ordered=TRUE)
|
iris$ord<-factor(sample(1:3,size=nrow(iris),replace=TRUE),ordered=TRUE)
|
||||||
result <- generic_stroke(df=iris, group = "Species", score = "ord", variables = colnames(iris)[1:3])
|
result <- generic_stroke(df=iris, group = "Species", score = "ord", variables = colnames(iris)[1:3])
|
||||||
expect_equal(length(result), 3)
|
expect_equal(length(result), 3)
|
||||||
})
|
expect_equal(class(result), "list")
|
||||||
|
})
|
@ -12,4 +12,17 @@ test_that("quatile_cut() works for detail.list==FALSE", {
|
|||||||
expect_type(result, "list")
|
expect_type(result, "list")
|
||||||
})
|
})
|
||||||
|
|
||||||
################################################################################
|
################################################################################
|
||||||
|
|
||||||
|
# Test created using remotes::install_github("JamesHWade/gpttools") unit test addin.
|
||||||
|
test_that("quantile_cut works correctly", {
|
||||||
|
x <- runif(100)
|
||||||
|
groups <- 5
|
||||||
|
y <- runif(100)
|
||||||
|
expect_equal(quantile_cut(x, groups, y, na.rm = TRUE),
|
||||||
|
cut(x, quantile(y, probs = seq(0, 1, 1/groups), na.rm = TRUE, names = TRUE, type = 7),
|
||||||
|
include.lowest = TRUE, labels = NULL, ordered_result = FALSE))
|
||||||
|
})
|
||||||
|
|
||||||
|
################################################################################
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user