R/sort_rightleft.R

#' Left-right order
#' 
#' Order the numbers 1 through \code{n}, starting at index \code{i} and
#' proceeding rightward then leftward.
#' 
#' @param n A positive integer.
#' @param i An integer between 1 and \code{n}.
sort_rightleft <- function(x, i) {
  n <- length(x)
  ord <- rightleftorder(n, i)
  x[ord]
}
akonstor/mypackage documentation built on May 10, 2019, 8:32 a.m.