How do you get significant differences to show with custom table, when using text instead of labelled numerics as input? (should be + or – in each cell).
#Generate data
aw = function(n) {
sample(x = c("Aware","Consider","Buy"), n, replace = T, prob = c(0.1, 0.4, 0.5))
}
awa<-aw(3000)
gen = function(n) {
sample(x = c("Male","Female"), n, replace = T, prob = c(0.8, 0.2))
}
gende<-gen(3000)
ag = function(n) {
sample(x = c("<20","20 to 50","50+"), n, replace = T, prob = c(0.3, 0.2, 0.5))
}
age<-ag(3000)
data<-data.frame(awa,gende,age)
#Banner create
banner = calc(data, list(total(), gende,age))
#Custom table with significant differences calculated relative to total
data %>%
tab_significance_options(compare_type = "adjusted_first_column",subtable_marks = "both",sig_labels_first_column = c("-", "+"),mode = c("append")) %>%
tab_cells(awa) %>%
tab_cols(banner) %>%
tab_stat_cpct() %>%
tab_pivot()