R/reverse.R

Defines functions reverse

Documented in reverse

#' Reverse String Order
#'
#' @param x can be number, strings, verctors
#'
#' @return reversed string
#' @export
#'
#' @examples 
#' reverse(123)
#' reverse(c(123,'abc'))
#' 
reverse <- function(x){
    x=as.character(x)
    x=sapply(x,function(i) paste0(rev(strsplit(i,'')[[1]]),collapse = ''))
    names(x)=NULL
    x
}

Try the do package in your browser

Any scripts or data that you put into this service are public.

do documentation built on Aug. 3, 2021, 5:06 p.m.