Skip to content

Commit

Permalink
skipping tests with seed element on R release version
Browse files Browse the repository at this point in the history
  • Loading branch information
IndrajeetPatil committed Apr 10, 2019
1 parent b366807 commit e974e3e
Show file tree
Hide file tree
Showing 5 changed files with 10 additions and 99 deletions.
103 changes: 4 additions & 99 deletions tests/testthat/test_ggcoefstats.R
Original file line number Diff line number Diff line change
Expand Up @@ -168,6 +168,7 @@ testthat::test_that(
desc = "ggcoefstats with partial variants of effect size for f-statistic",
code = {
testthat::skip_on_cran()
testthat::skip_if_not(R.version$minor >= "6.0")

## partial eta-squared

Expand Down Expand Up @@ -377,6 +378,7 @@ testthat::test_that(
desc = "ggcoefstats with non-partial variants of effect size for f-statistic",
code = {
testthat::skip_on_cran()
testthat::skip_if_not(R.version$minor >= "6.0")

# model
set.seed(123)
Expand Down Expand Up @@ -640,6 +642,7 @@ testthat::test_that(
desc = "check gmm output",
code = {
testthat::skip_on_cran()
testthat::skip_if_not(R.version$minor >= "6.0")

# setup
set.seed(123)
Expand Down Expand Up @@ -715,6 +718,7 @@ testthat::test_that(
desc = "check clm models (minimal)",
code = {
testthat::skip_on_cran()
testthat::skip_if_not(R.version$minor >= "6.0")

# clm model
set.seed(123)
Expand Down Expand Up @@ -758,105 +762,6 @@ testthat::test_that(
}
)

# check clm models (detailed) -------------------------------------------------

testthat::test_that(
desc = "check clm models",
code = {
testthat::skip_on_cran()
testthat::skip_on_appveyor()
testthat::skip_on_travis()

# creating broom dataframes
set.seed(123)
mod <- ordinal::clm(
data = ggstatsplot::intent_morality,
formula = as.factor(rating) ~ belief * outcome * question
)

# selecting intercept terms
df1 <- broom::tidy(
x = mod,
conf.int = TRUE
) %>%
dplyr::filter(.data = ., coef.type == "intercept")

# selecting beta terms
df2 <- broom::tidy(
x = mod,
conf.int = TRUE,
exponentiate = TRUE
) %>%
dplyr::filter(.data = ., coef.type == "location")

# computed dataframes
tidy_df1 <-
ggstatsplot::ggcoefstats(
x = df1,
statistic = "z",
output = "tidy",
coefficient.type = "intercept"
)
tidy_df2 <-
ggstatsplot::ggcoefstats(
x = df2,
exponentiate = TRUE,
statistic = "z",
output = "tidy"
)

# checking confidence intervals
testthat::expect_identical(df1$conf.low[1], NA_real_)
testthat::expect_identical(df1$conf.high[1], NA_real_)
testthat::expect_identical(tidy_df1$conf.low[1], NA_real_)
testthat::expect_identical(tidy_df1$conf.high[1], NA_real_)
testthat::expect_identical(
tidy_df1$label,
c(
"list(~italic(beta)==-2.49, ~italic(z)==-27.31, ~italic(p)<= 0.001)",
"list(~italic(beta)==-1.86, ~italic(z)==-21.29, ~italic(p)<= 0.001)",
"list(~italic(beta)==-1.41, ~italic(z)==-16.57, ~italic(p)<= 0.001)",
"list(~italic(beta)==-0.59, ~italic(z)==-7.21, ~italic(p)<= 0.001)",
"list(~italic(beta)==-0.08, ~italic(z)==-0.95, ~italic(p)==0.343)",
"list(~italic(beta)==0.61, ~italic(z)==7.39, ~italic(p)<= 0.001)"
)
)

testthat::expect_identical(
tidy_df2$label,
c(
"list(~italic(beta)==1.11, ~italic(z)==-19.34, ~italic(p)<= 0.001)",
"list(~italic(beta)==1.20, ~italic(z)==-14.85, ~italic(p)<= 0.001)",
"list(~italic(beta)==9.04, ~italic(z)==6.84, ~italic(p)<= 0.001)",
"list(~italic(beta)==3.31, ~italic(z)==1.03, ~italic(p)==0.305)",
"list(~italic(beta)==2.00, ~italic(z)==-2.26, ~italic(p)==0.024)",
"list(~italic(beta)==4.02, ~italic(z)==2.04, ~italic(p)==0.041)",
"list(~italic(beta)==1.85, ~italic(z)==-1.96, ~italic(p)==0.050)"
)
)

# checking statistics
testthat::expect_equal(df1$estimate, tidy_df1$estimate, tolerance = 0.001)
testthat::expect_equal(df1$std.error, tidy_df1$std.error, tolerance = 0.001)
testthat::expect_equal(df1$p.value, tidy_df1$p.value, tolerance = 0.001)
testthat::expect_identical(
tidy_df1$significance,
c("***", "***", "***", "***", "ns", "***")
)
testthat::expect_identical(
tidy_df1$p.value.formatted2,
c(
"<= 0.001",
"<= 0.001",
"<= 0.001",
"<= 0.001",
"==0.343",
"<= 0.001"
)
)
}
)

# checking bayesian models work ------------------------------------------

testthat::test_that(
Expand Down
1 change: 1 addition & 0 deletions tests/testthat/test_gghistostats.R
Original file line number Diff line number Diff line change
Expand Up @@ -404,6 +404,7 @@ testthat::test_that(
desc = "checking with default binwidth",
code = {
testthat::skip_on_cran()
testthat::skip_if_not(R.version$minor >= "6.0")

# creating a subset of the dataset
set.seed(123)
Expand Down
1 change: 1 addition & 0 deletions tests/testthat/test_kw_eta_h_ci.R
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@ testthat::test_that(
desc = "confidence interval for effect size for Kruskal-Wallis test ",
code = {
testthat::skip_on_cran()
testthat::skip_if_not(R.version$minor >= "6.0")

# percentile
set.seed(123)
Expand Down
1 change: 1 addition & 0 deletions tests/testthat/test_mean_labeller.R
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@ testthat::test_that(
desc = "mean_labeller works",
code = {
testthat::skip_on_cran()
testthat::skip_if_not(R.version$minor >= "6.0")
testthat::skip_on_appveyor()
testthat::skip_on_travis()

Expand Down
3 changes: 3 additions & 0 deletions tests/testthat/test_subtitle_anova_robust.R
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@ testthat::test_that(
desc = "subtitle_anova_robust works - between-subjects",
code = {
testthat::skip_on_cran()
testthat::skip_if_not(R.version$minor >= "6.0")
set.seed(123)

# ggstatsplot output
Expand Down Expand Up @@ -116,6 +117,8 @@ testthat::test_that(
desc = "subtitle_anova_robust works - within-subjects",
code = {
testthat::skip_on_cran()
testthat::skip_if_not(R.version$minor >= "6.0")

set.seed(123)
library(jmv)
data("bugs", package = "jmv")
Expand Down

0 comments on commit e974e3e

Please sign in to comment.