Learn R Programming

lettercase (version 0.13.1)

str_transform: str_transform

Description

Convert a string by applying one or more str_* functions.

Usage

str_transform(string, ...)

Arguments

string
vector. This must be an atomic vector, and will be coerced to a character vector
...
one or more functions to apply to the string

Value

a character vector

Details

str_transform applies successive functions to its first argument, string.

See Also

make_str_replace make_str_delete

Examples

Run this code
string = c( "catch-22", "finnegans wake" )
  str_transform( string, str_capitalize )

  str_transform( string, str_capitalize, str_delete_nonword )
  str_delete_nonword( str_capitalize( string ) )      # SAME

  ## Not run: 
#     # magrittr:
#     string %>% str_capitalize %>% str_delete_nonword   # SAME
#   ## End(Not run)

Run the code above in your browser using DataLab