为什么函数 svyCreateTableOne 有效,但我无法打印连续结果?

时间:2021-07-29 15:40:22

标签: r printing rounding survey

我在打印 svyCreateTableOne 的结果时遇到问题。 一开始,我的所有变量都是数字类,我在向量“catvar”中指定将由 svyCreateTableOne 作为分类处理的变量。我只能打印分类变量的结果。

#all variables
listvar<- c("age","female","depre","manic","anxiety","subst",
                 "diuretics","lipid","nsaids","antiepileptics","tot_meds") 
    
    continuous <- c("age","tot_meds") 
    
    catvar <- listvar[!listvar %in% continuous] # specify that all other variables except the ones specified previously are categorical

    #create weighted survey
    adjusted_data <- svydesign(ids = ~ trt, data = dat.temp, weights = ~ sw)
    
    
    ## Weighted table with tableone package
    tabadj<-svyCreateTableOne(vars = listvar, strata = "trt", data = adjusted_data, factorVars = catvar)
    
    print(tabadj, test = FALSE, smd = TRUE)
<块引用>

回合错误(n,数字=数字): 数学函数的非数字参数

0 个答案:

没有答案
相关问题