HI Alain,
Try this:
df.breaks<-data.frame(id=df[,1],sapply(df[,-1],function(x)
findInterval(x,quantile(x),rightmost.closed=TRUE)),stringsAsFactors=FALSE)
df.breaks
# id a b c
#1 x01 1 1 1
#2 x02 1 1 1
#3 x03 2 2 2
#4 x04 3 3 3
#5 x05 4 4 4
#6 x06 4 4 4
A.K.
- Original Message -
From:
Hi Alain,
The following should get you started:
apply(df[,-1], 2, function(x) cut(x, breaks = quantile(x), include.lowest =
TRUE, labels = 1:4))
Check ?cut and ?apply for more information.
HTH,
Jorge.-
On Tue, Feb 19, 2013 at 9:01 PM, D. Alain <> wrote:
> Dear R-List,
>
> I would like to re
2 matches
Mail list logo