我正在制作健康变量的汇总表。有一些条件变量仅在选择另一个变量的值时进行观察:如果患者对是否接受了呼吸支持回答“是”,则具有呼吸支持类型的因素变量。
我正在使用 table1 包:https://cran.r-project.org/package=table1
我的问题是,使用“table1”生成的单个表格将给出呼吸支持类型的缺失数据的错误数量,因为它包括对“是否接受过呼吸支持”也回答“否”的患者。
我想知道是否可以总结那些在 table1 函数中只回答“是”的人的数据。 例如数据集是这样的:
data.frame(received_resp_support = c("no", "yes", "yes", "yes"), type_resp_support = factor(c(NA, "A", "B", NA)))
第一个 NA 是因为个人没有获得支持,第二个 NA 是真正的缺失数据。在表 1 中,使用此数据框,根据上述内容,对于缺失的数据行当它应该是一个时
有两个观察值。
library(table1)
table1(~received_resp_support+type_resp_support, data=a)