nums_in_strings: Dealing with strings with numbers

remove_numsR Documentation

Dealing with strings with numbers

Description

Dealing with strings with numbers

Usage

remove_nums(x, trimws = FALSE)

extract_nums_tgthr(x)

extract_nums_all(x)

Arguments

x

character vector, or other vector which will be coerced to character

trimws

logical. whether to call base::trimws(), trimming all whitespace at start of end of string before returning.

Functions

  • remove_nums(): remove all the numbers from a string

  • extract_nums_tgthr(): extract the numbers from a string all together (i.e. ⁠12aaa34⁠ -> 1234)

  • extract_nums_all(): extract all the separate numbers from a string. returns list of numeric vectors. (i.e., 12aaa34 -> ⁠[1] 12 [2] 34⁠)


WhiteJP/jpw documentation built on April 17, 2025, 5:47 a.m.