I guess this is really basic. But I do not find an answer yet. I have a big data.frame. I would like to divede them into 10 deciles accounding to one of its member. Then I need a number for each decile with some computaion within each group. How to devide it?
devide data into decile
3 messages · Guojun Zhu, Uwe Ligges, Frank E Harrell Jr
Guojun Zhu wrote:
I guess this is really basic. But I do not find an answer yet. I have a big data.frame. I would like to divede them into 10 deciles accounding to one of its member. Then I need a number for each decile with some computaion within each group. How to devide it?
For example, the result of cut() as a new variable to the data.frame and afterwards split() the data.frame by the resulting factor. Uwe Ligges
______________________________________________ R-help at stat.math.ethz.ch mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide! http://www.R-project.org/posting-guide.html
Uwe Ligges wrote:
Guojun Zhu wrote:
I guess this is really basic. But I do not find an answer yet. I have a big data.frame. I would like to divede them into 10 deciles accounding to one of its member. Then I need a number for each decile with some computaion within each group. How to devide it?
For example, the result of cut() as a new variable to the data.frame and afterwards split() the data.frame by the resulting factor.
Or library(Hmisc) xg <- cut2(x, g=10) # labels deciles nicely Frank
Uwe Ligges
Frank E Harrell Jr Professor and Chair School of Medicine
Department of Biostatistics Vanderbilt University