Skip to contents

Conversion of text representing a number to a valid number

Usage

hsChrToNum(x, country, stopOnError = TRUE)

Arguments

x

(vector of) text value(s) to be converted to numeric

country

"en" if value(s) in x is (are) given in English format (decimal point ".", thousands separator ",") or "de" if value is given in German format (decimal point ",", thousands separator ".").

stopOnError

if TRUE (default) the program stops if any of the given values could not be converted.

Value

vector of numeric(s). In case of conversion the function stops (if

stopOnError = TRUE) or returns NA for those indices for which the conversion failed. In the latter case an attribute "errorIndices" containing the corresponding indices is assigned to the result vector.