##---- 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 (pos, v)
{
w <- v[pos[1]:pos[2]][!is.na(v[pos[1]:pos[2]])]
return(median(sample(w, length(w), replace = T), na.rm = T))
}Run the code above in your browser using DataLab