使用miceadds包mi.anova函数遇'assignment is deprecated'警告求助
解决miceadds::mi.anova的弃用警告问题
问题原因
你错误地将formula参数以带"formula="前缀的字符串形式传入,这种写法属于被弃用的赋值方式,mi.anova的formula参数需要直接接收公式对象,而非包含赋值语句的字符串。
修正代码
直接通过命名参数传递公式对象(无需引号包裹):
SWManova <- mi.anova(mi.res=imputed_Data, formula=outcome~person+age+sex+level_of_education, type=3)
或者先定义公式对象再传入:
my_formula <- outcome~person+age+sex+level_of_education SWManova <- mi.anova(mi.res=imputed_Data, formula=my_formula, type=3)
说明
以上两种写法都能正确传递公式参数,避免触发"assignment is deprecated"的弃用警告,符合mi.anova函数的参数要求。
内容的提问来源于stack exchange,提问作者DW1310
相关产品推荐
相关产品推荐

