R/substr_right.R

Defines functions substr_right

Documented in substr_right

#' Cut character vector from the right
#'
#' This function allows you to crop a vector of type `character` from the right
#' @param x a vector of type `character`
#' @param n a defined length
#' @examples
#' substrRight("character vector", 6)
#' @author Jeppe Vierø
#' @export

substr_right <- function(x, n){
  base::substr(x, base::nchar(x)-n+1, base::nchar(x))
}
jvieroe/rtools documentation built on Jan. 10, 2022, 12:36 a.m.