str_rev: Reverse every element of a vector

View source: R/string_tools.R

str_revR Documentation

Reverse every element of a vector

Description

This reverses the individual elements (makes words go backwards, for example), but does not change the order of those elements in the vector.

Usage

str_rev(..., USE.NAMES = FALSE)

Arguments

...

(Vectors) Vectors that will be coerced to Character and joined together.

USE.NAMES

(Logical) Should the output be a named vector, or unnamed?

Value

A Character vector where every element from the original vectors has been reversed, but the order of the elements within that vector is still the same. NAs remain as NA.

Authors

Source

https://stackoverflow.com/a/14029000/5578429

Examples

vec <- c("Beret", "Clipper", "Cornet", NA)
str_rev(vec)

#> [1] "tereB"   "reppilC" "tenroC"  NA


DesiQuintans/desiderata documentation built on April 9, 2023, 5:43 a.m.