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

Popular posts from this blog

ubuntu - PHP script to find files of certain extensions in a directory, returns populated array when run in browser, but empty array when run from terminal -

php - How can i create a user dashboard -

javascript - How to detect toggling of the fullscreen-toolbar in jQuery Mobile? -