str_is: Test whether strings are of the specified type

Description Usage Arguments Details Value See Also Examples

View source: R/str_is.R

Description

Family of functions for testing whether strings are of the specified type.

Usage

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15

Arguments

string

vector. This must be an atomic vector, and will be coerced to a character vector

type

function that transforms the string to type

autostart

integer; number of elements to test before concluding that string is of the suggested type. (Default: 30)

...

arguments passed to subsequent functions

Details

str_is determines if the string belongs to one of the supported lettercase types. Comparisons are made by comparing the original string to a transformed version of the string. If the two are identical, then the functions are equivalent.

autostart determines the maximum number of values

make_str_is and make_string_are are metafunctions that return functions that test for the given lettercase types.

Value

For str_is a logical vector indicating which entries of string are of the specified type,

For str_is_all and str_are a logical vector of length one indicating whether all of string is of the specified type(s)

For make_str_is and make_str_are functions that return functions that accept a single argument and return whether the string is of the specified types.

See Also

str_transform
make_str_replace
make_str_delete

Examples

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
string = c( "catch-22", "finnegans wake" )
  str_is( string, str_lower_case )

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

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

lettercase documentation built on May 29, 2017, 12:28 p.m.

Search within the lettercase package
Search all R packages, documentation and source code