Re: [R] Create a categorical variable using the deciles of data

2022-06-15 Thread Richard O'Keefe
I had the advantage of studying Becker, R. A., Chambers, J. M. and Wilks, A. R. (1988) "The New S Language". Wadsworth & Brooks/Cole. before starting to use R. That book was reissued by CRC Press only a few years ago. It's *still* a pretty darned good intro to R. cut, pretty, and

Re: [R] Create a categorical variable using the deciles of data

2022-06-14 Thread Ebert,Timothy Aaron
Hana, the "right" answer depends on exactly what you need. Here are three correct solutions. They use the same basic strategy to give different results. There are also other approaches in R to get the same outcome. You could use data_catigocal[i,j] and some for loops. size1 <-5 ngroup <-