I have a large data.frame file, and I would like to be able to reduce it using a subset of the quantiles of one of the variables. For instance:
x <- c(1:10,1:10,1:10,1:10,1:10,1:10,1:10,1:10,1:10,1:10)
df <- data.frame(x,rnorm(100))
df2 <- subset(df, df$x == 1)
df3 <- subset(df2, df2[2] > quantile(df2$rnorm.100.,0.8))
What I would like to get is a data.frame which contains all the quantiles for x = 1,2,3 ... 10.
Is there a way to do this with ddply?
source
share