R/reverse_str.R

Defines functions reverse_str

Documented in reverse_str

#' Reverse a string
#'
#' \code{reverse_str} takes a vector of strings and returns those strings backwards
#'
#' @param string vector of strings to be reversed
#'
#' @return Vector of strings the same length as \code{string}
#'
#' @examples
#' x <- 'abcd'
#' reverse_str(x)
#'
#' @export
reverse_str <- function(string) sapply(lapply(strsplit(string, NULL), rev), paste, collapse = "")
amorris28/amorris documentation built on Nov. 24, 2022, 6:39 a.m.