x=sample(1:10,10)
thresh=3
top_thresh(x,thresh)
## The function is currently defined as
function (vect, thresh)
{
sorted_vect <- sort(abs(vect),decreasing=TRUE)
v = sorted_vect[thresh]
ifelse(abs(vect) >= v, vect, v)
}
Run the code above in your browser using DataLab