Description Usage Arguments See Also Examples
Extract the n
th nonnumeric bit of a string where numbers are optionally
defined with decimals, scientific notation and commas (as separators, not as
an alternative to the decimal point).
str_first_non_numeric(...)
is just
str_nth_non_numeric(..., n = 1)
.
str_last_non_numeric(...)
is
just str_nth_non_numeric(..., n = 1)
.
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27  str_nth_non_numeric(
string,
n,
decimals = FALSE,
leading_decimals = decimals,
negs = FALSE,
sci = FALSE,
commas = FALSE
)
str_first_non_numeric(
string,
decimals = FALSE,
leading_decimals = decimals,
negs = FALSE,
sci = FALSE,
commas = FALSE
)
str_last_non_numeric(
string,
decimals = FALSE,
leading_decimals = decimals,
negs = FALSE,
sci = FALSE,
commas = FALSE
)

string 
A string. 
n 
A vector of integerish values. Must be either length 1 or
have length equal to the length of 
decimals 
Do you want to include the possibility of decimal numbers
( 
leading_decimals 
Do you want to allow a leading decimal point to be the start of a number? 
negs 
Do you want to allow negative numbers? Note that double negatives are not handled here (see the examples). 
sci 
Make the search aware of scientific notation e.g. 2e3 is the same as 2000. 
commas 
Allow comma separators in numbers (i.e. interpret 1,100 as a single number (one thousand one hundred) rather than two numbers (one and one hundred)). 
Other nonnumeric extractors:
str_extract_non_numerics()
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17  strings < c(
"abc123def456", "abc0.12def.345", "abc.12e4def34.5e9",
"abc1,100def1,230.5", "abc1,100e3,215def4e1,000"
)
str_nth_non_numeric(strings, n = 2)
str_nth_non_numeric(strings, n = 2, decimals = TRUE)
str_first_non_numeric(strings, decimals = TRUE, leading_decimals = FALSE)
str_last_non_numeric(strings, commas = TRUE)
str_nth_non_numeric(strings,
n = 1, decimals = TRUE, leading_decimals = TRUE,
sci = TRUE
)
str_first_non_numeric(strings,
decimals = TRUE, leading_decimals = TRUE,
sci = TRUE, commas = TRUE, negs = TRUE
)
str_first_non_numeric(c("22", "1.2.3"), decimals = TRUE)

Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.