0

Does anyone knows a way to print in tables generated through the expss package the row labels in the same way as the value labels? This question is linked to a former post in which the split_columns command is proposed as a solution. I am looking for a way though to produce a table book with a clean and standard look and feel to export to excel. I have tried by converting to category encoding which gives the same result as dichotomy encoding.

Table as is

Table wished

Tx, micha

1 Answers1

0

You need to use mdset for dichotomy set or mrset for categories. Example with mdset:

library(expss)
demo = text_to_columns("
    dummy1 dummy2 dummy3 survey_weight
    1        0        0           1.5
    1        1        0           1.5
    1        1        1            .5
    0        1        1           1.5
    1        1        1            .5
    0        0        1            .5
") 


demo %>% 
    tab_cells(mdset(dummy1 %to% dummy3)) %>%  # 'mdset' designate that with have multiple dichotomy set
    tab_weight(survey_weight) %>% # weight
    tab_stat_cpct() %>% # statistic
    tab_pivot() 

# |              | #Total |
# | ------------ | ------ |
# |       dummy1 |   66.7 |
# |       dummy2 |   66.7 |
# |       dummy3 |   50.0 |
# | #Total cases |    6.0 |
Gregory Demin
  • 4,596
  • 2
  • 20
  • 20