Counting cases, two conditions, range of values

早过忘川 提交于 2021-02-11 12:31:24

问题


I already found out how to count cases based on two conditions:

sum(dat2$happy > 7 & dat2$induction == 1)

But do you know how I can include a range of values as a criterion? One out of many codes I tried:

sum(dat2[dat2$happy > 4 & dat2$happy < 8] & dat2$induction == 2)

Tank you so much!

来源:https://stackoverflow.com/questions/65923147/counting-cases-two-conditions-range-of-values

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!