num_extract | R Documentation |
Simple wrapper for some regex to extract only the numbers from a character string. Source: http://stla.github.io/stlapblog/posts/Numextract.html. There are some other pretty cool functions after the link too.
num_extract(string, as_char = TRUE)
string |
A value or vector with mix of numbers and characters |
as_char |
Logical; if |
A vector or value; character or numeric
num_extract("30.5ml")
pvals <- c('0.00000', '< 0.001', '0.0', '0.123', '0.6', '1', '1.0', '1.000')
num_extract(pvals)
num_extract(pvals, as_char = FALSE)
negatives <- c(-0.133213, -0.06023, -0.004233, -0.000000134234, -1)
num_extract(negatives)
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.