indexing - How to get values in a data range in R -
i have table goes follows:
zip code approvalrate ...
75229 0.32 ...
i split approval rate quantiles, discounting zip codes approval rate 0 or 100%, breaks 0.0303 0.3333 0.4394 0.5060 0.6190 0.9524
naming very low, low, med, high, high
now make new vector of lowzip
zip codes approval rate falls low
range of 0.0303 - 0.3333
i have tried
idxlow = which(0.0303 <= approval & approval <= 0.333)
and
ziplow = mydata[idxlow, 1]
but have think there better way.
just:
mydata[0.0303 <= approval & approval <= 0.333, 1]
should work.
Comments
Post a Comment