I have a dataset that abbreviates numerical values in a column. For example, 12M mean 12 million, 1.2k means 1,200. M and k are the only abbreviations. How can I write code that allows R to sort these values from lowest to highest?
I've though about using gsub to convert M to 000,000 etc but that does not take into account the decimals (1.5M would then be 1.5000000).
system()
if it is installed on your system and in the PATH. Something likesystem(paste("numfmt --from=auto --to=none", "12M"), intern = TRUE)
. – Flavia12.00k
or0.012k
are not normalized, for example) – CashNA
,NaN
,Inf
without blowing up? – Cash