【发布时间】:2019-12-16 12:09:21
【问题描述】:
我有一个 data.frame HERE。使用subset() 我试图取出study.names(data.frame 中的一列)只有1s 变量post 而不是2 或3。
因此,我的期望输出是找出有多少研究只有post == 1,没有post == 2,或3。
这是我尝试但没有成功的方法:
D <- read.csv("https://raw.githubusercontent.com/izeh/m/master/k.csv", h = T) # The data
m <- split(D, D$study.name) ; m[[1]] <- NULL # split by `study.names`
subset(m, post == 1 & post != 2 & post != 3) # subset studies with only post == 1
# but not post == 2 and post == 3
Error: object 'post' not found
【问题讨论】:
标签: r list dataframe subset lapply