Colors a flextable based on the result of a SensoMineR::decat according to 2 threshold levels.

sensoTable(
  res.decat,
  thres = 0.05,
  thres2 = 0,
  col.neg = "#ff7979",
  col.neg2 = "#eb4d4b",
  col.pos = "#7ed6df",
  col.pos2 = "#22a6b3"
)

Arguments

res.decat

result of a SensoMineR::decat

thres

the threshold under which cells are colored col.neg (or col.pos) if the tested coefficient is significantly lower (or higher) than the average

thres2

the threshold under which cells are colored col.neg2 (or col.pos2); this threshold should be lower than thres

col.neg

the color used for thres when the tested coefficient is negative

col.neg2

the color used for thres2 when the tested coefficient is negative

col.pos

the color used for thres when the tested coefficient is positive

col.pos2

the color used for thres2 when the tested coefficient is positive

Value

Returns a formatted flextable

Details

This function is useful to highlight elements which are significant, especially when there are many values to check

Examples

### Example 1
data("sensochoc")
# Use the decat function
resdecat <-SensoMineR::decat(sensochoc, formul="~Product+Panelist", firstvar = 5, graph = FALSE)
sensoTable(resdecat)
#> a flextable object.
#> col_keys: `row.names(adjmeantable)`, `CocoaF`, `Bitterness`, `CocoaA`, `Granular`, `Astringency`, `Acidity`, `Crunchy`, `Sticky`, `Melting`, `Sweetness`, `Vanilla`, `Caramel`, `MilkA`, `MilkF` 
#> header has 1 row(s) 
#> body has 6 row(s) 
#> original dataset sample: 
#>       row.names(adjmeantable)   CocoaF Bitterness   CocoaA Granular Astringency
#> choc1                   choc1 8.068966   7.068966 7.086207 3.448276    4.758621
#> choc2                   choc2 6.913793   4.948276 6.551724 3.155172    3.155172
#> choc4                   choc4 6.689655   5.189655 6.258621 3.551724    3.689655
#> choc5                   choc5 6.793103   4.879310 6.793103 3.068966    3.103448
#> choc6                   choc6 6.224138   4.189655 6.362069 3.172414    2.758621
#>        Acidity  Crunchy   Sticky  Melting Sweetness  Vanilla  Caramel    MilkA
#> choc1 4.655172 5.965517 3.758621 4.741379  3.137931 1.103448 1.672414 3.586207
#> choc2 3.137931 7.706897 3.827586 4.327586  4.620690 1.810345 2.775862 4.000000
#> choc4 3.931034 6.103448 4.103448 4.379310  4.293103 2.120690 2.672414 4.103448
#> choc5 3.086207 6.637931 3.224138 4.741379  5.224138 1.793103 3.413793 4.172414
#> choc6 2.672414 7.327586 3.931034 4.206897  5.620690 1.913793 3.258621 4.568966
#>          MilkF
#> choc1 1.568966
#> choc2 2.379310
#> choc4 2.586207
#> choc5 3.120690
#> choc6 3.362069

### Example 2
data("sensochoc")
resdecat2 <-SensoMineR::decat(sensochoc, formul="~Product+Panelist", firstvar = 5, graph = FALSE)
sensoTable(resdecat2,thres2=0.01) # Add a second level of significance
#> a flextable object.
#> col_keys: `row.names(adjmeantable)`, `CocoaF`, `Bitterness`, `CocoaA`, `Granular`, `Astringency`, `Acidity`, `Crunchy`, `Sticky`, `Melting`, `Sweetness`, `Vanilla`, `Caramel`, `MilkA`, `MilkF` 
#> header has 1 row(s) 
#> body has 6 row(s) 
#> original dataset sample: 
#>       row.names(adjmeantable)   CocoaF Bitterness   CocoaA Granular Astringency
#> choc1                   choc1 8.068966   7.068966 7.086207 3.448276    4.758621
#> choc2                   choc2 6.913793   4.948276 6.551724 3.155172    3.155172
#> choc4                   choc4 6.689655   5.189655 6.258621 3.551724    3.689655
#> choc5                   choc5 6.793103   4.879310 6.793103 3.068966    3.103448
#> choc6                   choc6 6.224138   4.189655 6.362069 3.172414    2.758621
#>        Acidity  Crunchy   Sticky  Melting Sweetness  Vanilla  Caramel    MilkA
#> choc1 4.655172 5.965517 3.758621 4.741379  3.137931 1.103448 1.672414 3.586207
#> choc2 3.137931 7.706897 3.827586 4.327586  4.620690 1.810345 2.775862 4.000000
#> choc4 3.931034 6.103448 4.103448 4.379310  4.293103 2.120690 2.672414 4.103448
#> choc5 3.086207 6.637931 3.224138 4.741379  5.224138 1.793103 3.413793 4.172414
#> choc6 2.672414 7.327586 3.931034 4.206897  5.620690 1.913793 3.258621 4.568966
#>          MilkF
#> choc1 1.568966
#> choc2 2.379310
#> choc4 2.586207
#> choc5 3.120690
#> choc6 3.362069