"subscript out of bounds" error when adding significance test with expss

45 views Asked by At

I produced this table including significance tests using the expss package in R:

Chronic_cases2 = C_analysis %>% 
  tab_weight(weight = Finalweights) %>% 
  tab_cells(C1 == 1) %>% 
  tab_cols(YEAR) %>% 
  tab_rows(B3, REGION, UR, AGE_GROUPS, Quintile) %>% 
  tab_stat_cpct(total_statistic = "w_cases") %>% 
  tab_last_sig_cpct(
    sig_level = 0.05, 
    compare_type = "previous_column", 
    sig_labels_previous_column = c("*","*")
  ) %>% 
  tab_pivot() %>% 
  set_caption("Chronic conditions") 
wb = createWorkbook()  
sh = addWorksheet(wb,"Tables")
xl_write(Chronic_cases2,wb,sh)
saveWorkbook(wb, "table2.xlsx", overwrite = T)

It gives me the result I want. However, I have two issues with it. When I want to do the test for total(), as a tab_row function it says that the subscript is out of bounds.

Plus I want to test it for different significance levels, p < 0.1 ; p < 0.05; p < 0.01; with the different output labeling, for sig_level = 0.1 I want sig_labels_previous_column to be "*", for sig_level = 0.05 to be "**", and for 0.01 - "***", is it possible to do that with expss package?

0

There are 0 answers