How to perform a Chi-squared test on a row percent using expss package? I know the Significance testing on column percent should be applied on the result of tab_stat_cpct with total row. But I have a table like this and my Chi-squared p-value IS blank IN MY TABLE.
d=mtcars
banner <- d %>% tab_cells(vs, am)
# column percentage significacne
tab_cpct_sig=. %>%
tab_stat_cpct() %>%
tab_total_row_position("below") %>%
tab_total_statistic("u_rpct")
Table1 = function (Q, banner) {
eval.parent(substitute(
{
banner %>%
tab_cols (Q) %>%
tab_stat_rpct() %>%
tab_cols(total(Q)) %>%
tab_stat_cases() %>%
tab_last_sig_cases(sig_level = 0.05) %>%
tab_pivot(stat_position = "outside_columns") %>%
set_caption("Tableau 1") #%>%
}
))
}
A1=Table1(gear,banner)
A1
Currently expss only supports chi-square test on the entire table. However, we can make a function to add rowwise chi-square statistic: