#' Return All But Last Value
#'
#' Return all but the last value in a vector
#' @param x Atomic vector
#' @export
#' @return x[-length(x)]
#' @examples
#' allbutlast(x = 1:10)
allbutlast <- function(x){
if (is.atomic(x)){
return(x[-length(x)])
}else{
stop("'x' must be an atomic vector.")
}
}
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.