Try this: my.df$my.newvar <- quantile(my.df$my.var, probs = seq(0.01,1, 0.01))
On Sat, Sep 27, 2008 at 3:50 AM, Donald Braman <[EMAIL PROTECTED]> wrote: > I'm wondering if there is a simple way to assign a quantile to a vector in a > data frame, much like one could in Stata using centile. Let's say I want 100 > slices in my assignation. I can easily see what the limits of each slice by > using quantile: > quantile(my.df$my.var, probs=seq(0, 1, 0.01)) > > But how do I assign the appropriate value to each row/record in my data > frame? Clearly the following won't work, but what will? > > my.df$my.new.var <- quantile(my.df$my.var, probs=seq(0, 1, 0.01)) > > [[alternative HTML version deleted]] > > ______________________________________________ > R-help@r-project.org mailing list > https://stat.ethz.ch/mailman/listinfo/r-help > PLEASE do read the posting guide http://www.R-project.org/posting-guide.html > and provide commented, minimal, self-contained, reproducible code. > -- Henrique Dallazuanna Curitiba-Paraná-Brasil 25° 25' 40" S 49° 16' 22" O ______________________________________________ R-help@r-project.org mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide http://www.R-project.org/posting-guide.html and provide commented, minimal, self-contained, reproducible code.