r - Subsetting data into percentage groups -
i have 9k observations 2 variables want test correlation. subsetting value, had no issues with. realised wouldnt statistically significant correlation value groups due low observation count. have decided change approach group quantiles. can subset top x% no trouble, having difficulty figuring out how group data multiple percentiles i.e 0-5%, 5-10%, 10-15%. appreciated. thanks, jono
we can use cut2
function in hmisc
package
library(hmisc) cut2(x, g=20)
it divides data 20 quantiles wish
Comments
Post a Comment