I’m trying to find the variance of a subset of the whole data (dat) “pollutionData.csv”.
I want the variance of the PM2.5 levels when rain = 0.
var(PM2.5, data=subset(dat, RAIN == 0))
The code above isn’t working.
aggregate(dat[, 6], list(dat$RAIN==0), var, na.rm=TRUE)
The code above outputs the variance when the rain = 0 and when rain > 0, but I want to do a hypothesis test for the variances so this isn’t helpful.
Any help would be appreciated!