parseNumVec: Parse a character string into a numveric vector

Description Usage Arguments Details See Also Examples

View source: R/parseFuncs.R

Description

Numeric vectors can be given as arguments in two ways: (1) separated by blanks or (2) separated by other common separators, such as comma (,). This function parses a string, or a string vector into a numeric vector of expected length. In addition it is failure safe: user can specify the return value in case the parsing was not successful,

Usage

1
parseNumVec(str, expLen = 2, failVal = c(5, 5), sep = ",")

Arguments

str

A character string

expLen

Integer or NULL, Expected length of the numeric vector. When set to NULL, the numeric vector can be of variable length.

failVal

If the parsing failed (for example length not correct, or non-numeric values were provided, this value will be returned

sep

Separator in the character string, default ","

Details

The input value mostly comes from return values of the argGet function.

See Also

argGet

Examples

1
parseNumVec("3,7,9", expLen=3)

bedapub/ribiosArg documentation built on Nov. 4, 2021, 1:12 p.m.