Get quantile for each value

Is there an implemented (!) function in R which gives you the empirical quantile for each value? I couldn't find any ...

Let's say we have x

x = c(1,3,4,2)

I want to have the quantile of each element.

[1] 0.25, 0.75, 1, 0.5 


  • You can use the ecdf() function:

    [1] 0.25 0.75 1.00 0.50

    ecdf(x) creates a function, and you pass the elements of x to that function. The syntax admittedly looks strange