1 | Bin_Quantile(Obj, Nregions = 4)
|
Obj |
|
Nregions |
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 | ##---- Should be DIRECTLY executable !! ----
##-- ==> Define data, use random,
##-- or do help(data=index) for the standard data sets.
## The function is currently defined as
function (Obj, Nregions = 4)
{
Nbreaks = Nregions - 1
Breaks = quantile(Obj, prob = seq(0, 1, length = Nbreaks +
2))
Region = sapply(Obj, FUN = function(Num) {
sum(Num >= Breaks)
})
Region = ifelse(Region == (Nregions + 1), Nregions, Region)
if (is.array(Obj))
Region = array(Region, dim = dim(Obj))
Return = list(Nregions = Nregions, Region = Region, Lwr = Breaks[-c(Nbreaks +
2)], Upr = Breaks[-1])
return(Return)
}
|
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.