1

我的代码...

library(expss)
library(haven)
X4707 <- read_sav("/home/cfmc/4707/data/4707.sav")
X4707 %>% 
    tab_cells("By phone"=qpd4_1==1,"By email"=qpd4_2==1,"Utility website"=qpd4_3==1,"Roseville Electric notification"=qpd4_4==1,"Social media"=qpd4_5==1,"Text"=qpd4_6==1,"Not sure"=qpd4_8==1) %>% 
    tab_cols(total(), qf5) %>% 
    tab_stat_cpct() %>% 
    tab_last_sig_cpct() %>% 
    tab_pivot()

我的输出看起来像这样...... 在此处输入图像描述

我希望输出仅包含存根(通过电话、通过电子邮件等)向下传递的代码文本,而不包含 TRUE、FALSE 等。

4

1 回答 1

0

您需要指定您想要多重响应。您有多个位置编码选择,因此您需要mdset(m(ultiple) d(ichotomy) set) 函数:

library(expss)
library(haven)
X4707 <- read_sav("/home/cfmc/4707/data/4707.sav")
X4707 %>% 
    tab_cells(mdset("By phone"=qpd4_1==1,"By email"=qpd4_2==1,"Utility website"=qpd4_3==1,"Roseville Electric notification"=qpd4_4==1,"Social media"=qpd4_5==1,"Text"=qpd4_6==1,"Not sure"=qpd4_8==1)) %>% 
    tab_cols(total(), qf5) %>% 
    tab_stat_cpct() %>% 
    tab_last_sig_cpct() %>% 
    tab_pivot()
于 2021-02-19T20:10:28.183 回答