View source: R/extract_digits.R
extract_digits | R Documentation |
This function extracts the first (and optionally second) or last digits in a vector.
extract_digits(x, check = 'first', include.zero = FALSE)
x |
a numeric vector. |
check |
location of the digits to extract. Can be |
include.zero |
logical. Whether to include the digit zero in the output. |
A vector of first (and optionally second) or last digits.
Koen Derks, k.derks@nyenrode.nl
set.seed(1) x <- rnorm(100) # Extract first digits (without zero) extract_digits(x, check = 'first') # Extract last digits (including zero) extract_digits(x, check = 'last', include.zero = TRUE)
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.