tests/testthat/test-maxdifftable.R

context("MaxDiffTable")

probabilities <- structure(c(0.611525681882981, 0.0610316269064962, 0.0196495417610775,
                             0.109770173219371, 0.0293995220816906, 0.053582140249799, 0.0542225282202209,
                             0.0229627602502246, 0.018320548748006, 0.019535476680133, 0.0296463742092417,
                             0.118585164099962, 0.0455330492719019, 0.188428307189674, 0.0753169517641536,
                             0.213817719826495, 0.151650357780703, 0.0598285025845872, 0.041148975345747,
                             0.0760445979275344, 0.381713001726063, 0.0838838592620152, 0.029919060277125,
                             0.14102856444483, 0.0476122237580276, 0.11708901190242, 0.092858171254392,
                             0.0375845569748824, 0.0273789262294594, 0.0419326241707841), .Dim = c(10L, 3L),
                           .Dimnames = list(c("Apple", "Microsoft", "IBM", "Google", "Intel", "Samsung", "Sony", "Dell", "Yahoo", "Nokia"), NULL))
col.labels <- c("Class 1 (%)<br>Size: 60.5%", "Class 2 (%)<br>Size: 39.6%", "Total")

expect_error(MaxDiffTableClasses(probabilities, col.labels, title = "Max-diff",
                                   subtitle = "subtitle here", footer = "footer here"), NA)

stats.table <- structure(c(0.36412698192016, 0.0869817608518973, 0.0308602416215465,
            0.146677866028388, 0.0489379326572833, 0.118076819085196, 0.0951254259842467,
            0.0386069763456849, 0.0282690353994623, 0.0423369601061347, 0.555634855987284,
            0.0689649814920051, 0.0224360079738529, 0.123134221643735, 0.033768205752812,
            0.0631769688258134, 0.0626035631519489, 0.0264012779189992, 0.0208800191846593,
            0.0229998980688901, 0.0317160616249501, 0.0611117134909706, 0.0196774142153187,
            0.109906010416802, 0.029443004496869, 0.0536757184696238, 0.0543055952462912,
            0.0229969564664891, 0.0183461911100373, 0.0195693016785103, 0.610968094409088,
            0.118585164231818, 0.0455330255109979, 0.188428308539385, 0.0751858126644664,
            0.211801492882592, 0.151154718027997, 0.0597067439829996, 0.0411489753457564,
            0.0753601479847884, 0.0296463742093279, 0.0610324228074512, 0.0196498187328045,
            0.109771523260765, 0.02939995415028, 0.0535830699159254, 0.0542233535921533,
            0.0229631000425704, 0.0183208035630065, 0.0195358127229638, 0.611520141212079,
            0.121311080023917, 0.0455342351259591, 0.199313753575571, 0.0753169517641482,
            0.213817719826409, 0.151650357780682, 0.0598285025845822, 0.0411955267890948,
            0.0760445979275051), .Dim = c(10L, 6L), .Dimnames = list(c("Apple",
                                                                       "Microsoft", "IBM", "Google", "Intel", "Samsung", "Sony", "Dell",
                                                                       "Yahoo", "Nokia"), NULL))

expect_error(MaxDiffTable(stats.table, title = "Max-diff",
             subtitle = "subtitle here", footer = "footer here"), NA)
Displayr/flipFormat documentation built on Feb. 26, 2024, 12:37 a.m.