Re: [R] create new variable: percentile value of variable in data frame

2010-05-30 Thread David Winsemius
On May 30, 2010, at 9:03 AM, Jonathan Beard wrote: Hi Stephan, thanks for your response. It looks like the ecdf() works like it should. I have a quick follow-up: I didn't notice any discussion in the help documents of the methods behind ecdf() and quantile(type=3) being equivalent. It looks

Re: [R] create new variable: percentile value of variable in data frame

2010-05-30 Thread Jonathan Beard
Hi Stephan, thanks for your response. It looks like the ecdf() works like it should. I have a quick follow-up: I didn't notice any discussion in the help documents of the methods behind ecdf() and quantile(type=3) being equivalent. It looks like the results produced by each method are consisten

Re: [R] create new variable: percentile value of variable in data frame

2010-05-28 Thread Stephan Kolassa
Hi Jon, does the empirical cumulative distribution function do what you want? dat$q.score <- ecdf(dat$score)(dat$score) ?ecdf HTH Stephan Jonathan Beard schrieb: Hello all, Thanks in advance for you attention. I would like to generate a third value that represents the quantile value of a va

[R] create new variable: percentile value of variable in data frame

2010-05-28 Thread Jonathan Beard
Hello all, Thanks in advance for you attention. I would like to generate a third value that represents the quantile value of a variable in a data frame. # generating data x <- as.matrix(seq(1:30)) y <- as.matrix(rnorm(30, 20, 7)) tmp1 <- cbind(x,y) dat <- as.data.frame(tmp1) colnames(dat) <- c(