tests/testthat/test-get_summary_stats.R

context("test-get_summary_stats")

test_that("Checking that get_summary_stats keeps the order of columns specified by the user", {
  res <- data.frame(
    c = rnorm(50,10,5),
    b = rnorm(50,100,20),
    a = rnorm(50,0,1)
    ) %>%
    get_summary_stats(a, c, b, type = "mean_sd")
  obtained_var_order <- as.character(res$variable)
  expected_var_order <- c("a", "c", "b")
  expect_equal(obtained_var_order, expected_var_order)
})

Try the rstatix package in your browser

Any scripts or data that you put into this service are public.

rstatix documentation built on Feb. 16, 2023, 6:10 p.m.