I have a data set that has 200,00 rows what I want to do is simple, but I haven't found an answer to how. I tried this:
data$DCRank<-cut(data$DC,quantile(data$DC,(0:10)/10),include.lowest=TRUE)
But that doesn't give me a 1:10 result.
I have a data set that has 200,00 rows what I want to do is simple, but I haven't found an answer to how. I tried this:
data$DCRank<-cut(data$DC,quantile(data$DC,(0:10)/10),include.lowest=TRUE)
But that doesn't give me a 1:10 result.
This should work:
DCbreaks <- quantile(data$DC,probs=(seq(0,1,0.1)))
data$DCrank <- cut(data$DC, breaks=DCbreaks, labels=0:9+1, include.lowest=TRUE)