1+
12# htest -------------------------------------------------------------------
3+
24test_that(" t-test" , {
35 x <<- 1 : 10
46 y <<- c(1 , 1 : 9 )
@@ -319,6 +321,7 @@ test_that("htest | Get args from htest", {
319321
320322
321323# aov ---------------------------------------------------------------------
324+
322325test_that(" aov" , {
323326 data <- iris
324327 data $ Cat1 <- rep(c(" A" , " B" ), length.out = nrow(data ))
@@ -329,6 +332,7 @@ test_that("aov", {
329332
330333
331334# BayesFactor -------------------------------------------------------------
335+
332336test_that(" BayesFactor" , {
333337 skip_if_not_installed(" BayesFactor" )
334338 skip_on_cran()
@@ -353,6 +357,77 @@ test_that("BayesFactor", {
353357 expect_equal(effectsize(bf4 )[[1 ]], 0.3911 , tolerance = 0.03 )
354358})
355359
360+
361+ # datawizard::data_tabulate() ---------------------------------------------
362+
363+ test_that(" effectsize | datawizard crosstabs" , {
364+ skip_if_not_installed(" datawizard" , minimum_version = " 1.2.0" )
365+
366+ data(" mtcars" )
367+ xtabs1 <- datawizard :: data_tabulate(mtcars , select = " cyl" , by = " am" )
368+ xtab1 <- xtabs1 [[1 ]]
369+
370+ expect_equal(
371+ effectsize(xtabs1 ),
372+ cramers_v(mtcars $ cyl , mtcars $ am )
373+ )
374+ expect_equal(
375+ effectsize(xtabs1 ),
376+ effectsize(xtab1 )
377+ )
378+ expect_equal(
379+ effectsize(xtabs1 , type = " c" ),
380+ pearsons_c(mtcars $ cyl , mtcars $ am )
381+ )
382+ expect_equal(
383+ effectsize(xtab1 , type = " c" ),
384+ pearsons_c(mtcars $ cyl , mtcars $ am )
385+ )
386+
387+
388+ xtabs2 <- datawizard :: data_tabulate(mtcars , select = c(" cyl" , " gear" ), by = " am" )
389+ xtabs3 <- datawizard :: data_tabulate(datawizard :: data_group(mtcars , select = c(" carb" )),
390+ select = c(" cyl" , " gear" ), by = " am"
391+ )
392+ expect_error(effectsize(xtabs2 ), regexp = " Multilpe tables" )
393+ expect_error(effectsize(xtabs3 ), regexp = " Multilpe tables" )
394+ })
395+
396+ test_that(" effectsize | datawizard tables" , {
397+ skip_if_not_installed(" datawizard" , minimum_version = " 1.2.0" )
398+
399+ data(" mtcars" )
400+ tabs1 <- datawizard :: data_tabulate(mtcars , select = " cyl" )
401+ tab1 <- tabs1 [[1 ]]
402+
403+ expect_equal(
404+ effectsize(tabs1 ),
405+ fei(table(mtcars $ cyl ))
406+ )
407+ expect_equal(
408+ effectsize(tabs1 ),
409+ effectsize(tab1 )
410+ )
411+ expect_equal(
412+ effectsize(tabs1 , type = " c" ),
413+ pearsons_c(table(mtcars $ cyl ))
414+ )
415+ expect_equal(
416+ effectsize(tab1 , type = " c" ),
417+ pearsons_c(table(mtcars $ cyl ))
418+ )
419+
420+
421+ xtabs2 <- datawizard :: data_tabulate(mtcars , select = c(" cyl" , " gear" ))
422+ xtabs3 <- datawizard :: data_tabulate(datawizard :: data_group(mtcars , select = c(" carb" )),
423+ select = c(" cyl" , " gear" ))
424+ expect_error(effectsize(xtabs2 ), regexp = " Multilpe tables" )
425+ expect_error(effectsize(xtabs3 ), regexp = " Multilpe tables" )
426+ })
427+
428+
429+ # Other ----------------------------------------
430+
356431test_that(" effectsize | easycorrelation" , {
357432 skip_if_not_installed(" correlation" )
358433 r <- correlation :: correlation(mtcars )
0 commit comments