char2num | R Documentation |
Convert strings to numbers.
char2num(s, dec = ",", big.mark = ".")
s |
a character vector |
dec |
character: the decimal point; will be replaced with “ |
big.mark |
character: will be removed, see Details. |
char2num
uses as.numeric
on a character vector
after removing/replacing certain characters: all occurences of
big.mark
are removed, and dec
is changed to a dot.
a character vector
Enrico Schumann
as.numeric
, type.convert
char2num("12.000,23")
char2num("12,000.23", big.mark = ",")
char2num("12000.23", big.mark = " ") ## but 'as.numeric' is simpler
char2num("12'000.23", big.mark = "'")
char2num("12 000|23", dec = "|", big.mark = " ")
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.