Description Usage Arguments Examples
Extract numbers in character strings
1 |
x |
Atomic vector or list. |
simplify |
Logical or character string. Should the result be simplified to a vector, matrix or higher dimensional array if possible? |
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 | # Atomic character
x <- levels(cut(1:100, 3))
(out <- numIn(x))
# Atomic factor is coerced to character
x <- unique(cut(1:100, 3))
identical(numIn(x), out) # TRUE
# Works on list as well
x <- do.call(list, as.list(x))
identical(numIn(x), out) # TRUE
# When type is not character or factor the names are used
x <- do.call(list, as.list(1:3))
names(x) <- unique(cut(1:100, 3))
identical(numIn(x), out) # TRUE
# If names is NULL or empty the row.names are used instead
x <- matrix(1:6, 3)
row.names(x) <- levels(cut(1:100, 3))
is.null(names(x)) # TRUE
identical(numIn(x), out) # TRUE
|
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.