Learn R Programming

⚠️There's a newer version (2.0.1) of this package.Take me there.

strex

There are some things that I wish were easier with the stringr or stringi packages. The foremost of these is the extraction of numbers from strings. stringr lets you figure this out the regex for yourself; strex takes care of this for you. There are many more useful functionalities in strex. In particular, there’s a match_arg() function which is more flexible than the base match.arg(). Contributions to this package are encouraged: it is intended as a miscellany of string manipulation functions which cannot be found in stringi or stringr.

Installation

You can install the release version of strex from CRAN with:

install.packages("strex")

You can install the development version of strex from GitHub with:

devtools::install_github("rorynolan/strex")

How to use the package

See the package website at https://rorynolan.github.io/strex.

Copy Link

Version

Install

install.packages('strex')

Monthly Downloads

2,155

Version

0.1.3

License

GPL-3

Maintainer

Rory Nolan

Last Published

November 30th, 2018

Functions in strex (0.1.3)

str_locate_braces

Locate the braces in a string.
str_split_by_nums

Split a string by its numeric characters.
str_can_be_numeric

Check if a string could be considered as numeric.
str_elem

Extract a single character from a string, using its index.
str_match_arg

Argument Matching.
str_locate_nth

Locate the indices of the \(n\)th instance of a pattern.
str_alphord_nums

Make string numbers comply with alphabetical order.
str_extract_non_numerics

Extract non-numbers from a string.
currency

Get the currencies of numbers within a string.
str_singleize

Remove back-to-back duplicates of a pattern in a string.
str_extract_numbers

Extract numbers from a string.
str_remove_quoted

Remove the quoted parts of a string.
str_after_nth

Text before or after \(n\)th occurrence of pattern.
str_nth_number_after_mth

Find the \(n\)th number after the \(m\)th occurrence of a pattern.
str_trim_anything

Trim something other than whitespace
strex

strex: extra string manipulation functions
str_nth_number_before_mth

Find the \(n\)th number before the \(m\)th occurrence of a pattern.
str_before_last_dot

Get the part of a string before the last period.
str_paste_elems

Extract bits of a string and paste them together
str_give_ext

Ensure a file name has the intended extension.
str_split_camel_case

Split a string based on CamelCase
str_to_vec

Convert a string to a vector of characters