I need a function like xtile
in Stata, that given a vector, it returns which quantile each obs belongs to. So if the function is defined as
function xtile(vector; q= 4) #q = 4 by default returns quartiles
*** returns a vector with the same size as "vector", indicating which quantile each obs belongs to.
end
I want to use it in:
@pipe df |> transform(:height => xtile => :quantiles)
I know Stella.jl provides such functionality. But I can't install that package and now I'm wondering if there is another package for it. Or maybe I can implement it myself.