sensoTable: Color the cells of a data frame according to 2 threshold...

View source: R/sensoTable.R

sensoTableR Documentation

Color the cells of a data frame according to 2 threshold levels

Description

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

Usage

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

Details

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

Value

Returns a formatted flextable

Examples

### Example 1
data("sensochoc")
# Use the decat function
resdecat <-SensoMineR::decat(sensochoc, formul="~Product+Panelist", firstvar = 5, graph = FALSE)
sensoTable(resdecat)

### 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

Sebastien-Le/YesSiR documentation built on Sept. 3, 2023, 8:53 a.m.