Skip to contents

A simple function to transform a string of digits into a numeric vector.

Usage

str2dig(x, split = "", ...)

# S4 method for character
str2dig(x, split = "", ...)

# S4 method for list
str2dig(x, split = "", num.cores = 1L, tasks = 0L, verbose = FALSE, ...)

Arguments

x

A character string or a list/ of character strings of numeric/digit symbols.

split

The same as in strsplit

...

Further parameters for strsplit.

num.cores, tasks

Parameters for parallel computation using package BiocParallel-package: the number of cores to use, i.e. at most how many child processes will be run simultaneously (see bplapply and the number of tasks per job (only for Linux OS).

verbose

If TRUE, prints the function log to stdout.

Value

A integer vector or a list of integer vectors.

Author

Robersy Sanchez https://genomaths.com

Examples

## A integer vector
str2dig("12231456247")
#>  [1] 1 2 2 3 1 4 5 6 2 4 7

## A list of integer vectors
str2dig(list(num1 = "12231456247", num2 = "521436897"))
#> $num1
#>  [1] 1 2 2 3 1 4 5 6 2 4 7
#> 
#> $num2
#> [1] 5 2 1 4 3 6 8 9 7
#>