R/top_bot.R

Defines functions top bot

Documented in bot top

#' @title 
#' Top or bottom element of an object
#' 
#' @description 
#' \code{top(x)} is an alias for \code{head(x, 1L)}. 
#' \code{bot(x)} is an alias for \code{tail(x, 1L)}. 
#' 
#' @param x
#' an object. 
#' 
#' @return 
#' An object (usually) like \code{x} but generally smaller. 
#' 
#' @seealso 
#' \code{\link[utils]{head}} and \code{\link[utils]{head}} from package 
#' \pkg{utils}
#' 
#' @importFrom utils head
#' @export
#'
top <-
function(x)
{
  head(x, 1L)
}


#' @importFrom utils tail
#' @export
#' @rdname top
#'
bot <-
function(x)
{
  tail(x, 1L)
}
paulponcet/bazar documentation built on July 15, 2019, 5:28 a.m.