Re: [R] Get 10%, 50% and 90% Quantile of data samples with probability

2015-02-04 Thread JS Huang
Hi, To complete the last part: dist - function(x) + { + return(c(rep(x[1],15),rep(x[2],15),rep(x[3],25),rep(x[4],20),rep(x[5],25))) + } x - dist(c(2,3,2,5.3,7.3)) x [1] 2.0 2.0 2.0 2.0 2.0 2.0 2.0 2.0 2.0 2.0 2.0 2.0 2.0 2.0 2.0 3.0 3.0 3.0 3.0 3.0 3.0 3.0 3.0 3.0 3.0 3.0 3.0 3.0 [29]

Re: [R] Get 10%, 50% and 90% Quantile of data samples with probability

2015-02-03 Thread JS Huang
Hi, For you first task and use your first row of data as an example. Define a function named dist to take care of the probability for each group. dist - function(x) + { + return(c(rep(x[1],15),rep(x[2],15),rep(x[3],25),rep(x[4],20),rep(x[5],25))) + } plot(ecdf(dist(c(2,3,2,5.3,7.3