tests/testthat/test-meansd.R

# out1 <- meansd(x = mtcars$mpg)
# out2 <- meansd(x = mtcars$mpg, roundDig = 5, groupvar = mtcars$cyl, 
#                range = TRUE, add_n = TRUE, .german = TRUE)
# saveRDS(list(out1=out1, out2=out2),file = 'tests/testthat/meansdout.rda')
test_that("meansd() with defaults and options set", {
  expected <- readRDS('meansdout.rda')
  expect_equal(meansd(mtcars$mpg), expected[[1]])
  expect_equal(meansd(x = mtcars$mpg, roundDig = 5, groupvar = mtcars$cyl, 
                      range = TRUE, add_n = TRUE, .german = TRUE), 
               expected[[2]])
})

Try the wrappedtools package in your browser

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

wrappedtools documentation built on Sept. 24, 2023, 5:06 p.m.