Use `endsWith()` in R to test if strings end with a suffix. Returns a logical vector. Useful for filtering files by extension or validating paths.
Reference
String Functions
String handling and regex helpers.
- endsWith()
- format()
Format R objects for pretty printing, controlling decimal places and alignment. The function formats R objects for pretty printing.
- formatC()
Use `formatC()` in R for C-style numeric formatting with width, digits, and flag control. Formats numbers using C format specifications for fixed-width output.
- grep()
Use `grep()` in R to search for pattern matches in character strings, returning indices or values. Supports regex, fixed-string, and case-insensitive matching.
- grepl()
Use `grepl()` in R to search for pattern matches and return a logical vector. Supports regex, fixed-string, and case-insensitive matching for filtering.
- gsub()
Use `gsub()` in R to replace all occurrences of a pattern in strings using regex or fixed matching. Supports backreferences and case-insensitive search.
- nchar()
nchar() returns the length of a string in characters, bytes, or width units for display, essential for validation and text processing in R.
- startsWith()
startsWith() checks if each element of a character vector begins with a specified prefix in R, returning a logical vector for filtering and validation.
- strsplit()
strsplit() splits a character vector into substrings by finding matches of a delimiter pattern, returning a list of split components for each input element.
- sub()
sub() replaces only the first occurrence of a pattern in each string element using regex or fixed matching, distinct from gsub()'s global replacement.
- substring()
substring() extracts or replaces substrings in a character vector by position with vectorized start and stop arguments for flexible indexing.
- tolower()
tolower() converts character vectors to lowercase in R, essential for case-normalization when comparing strings and cleaning text data.
- toupper()
toupper() converts character vectors to uppercase in R, essential for case-normalization when comparing strings and standardizing text data.
- trimws()
trimws() removes leading and trailing whitespace from character strings in base R, essential for cleaning user input and text data before processing.