mercredi 27 janvier 2021

Counting cases, two conditions, range of values

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!

Aucun commentaire:

Enregistrer un commentaire