R/Largest and Smallest.R

Defines functions Smallest Largest

# Largest and smallest ####

Largest <-function(vector, no = 5, fun = "raw"){

  ordvec <- tail(sort(vector), no)

  if(fun == "which")   which(vector%in%ordvec) else ordvec

  }

Smallest <-function(vector, no = 5){
  which(vector%in%head(sort(vector), no))
}
gfalbery/ggregplot documentation built on Feb. 4, 2025, 3:17 a.m.