As the title suggests I'm looking for a way to transform short hand abbreviated 'character' text to numerical data. For example I'd like to make these changes within my dataframe:
84.06M -> 84,060,000
30.12B -> 30,120,000,000
9.78B -> 9,780,000,000
251.29M -> 251,29,000
Here's an example of some of the dataframe I'm working with:
Index Market Cap Income Sales Book/sh
ZX - 84.06M -1.50M 359.50M 7.42
ZTS S&P 500 30.13B 878.00M 5.02B 3.49
ZTR - - - - -
ZTO - 9.78B 288.30M 1.47B 4.28
ZPIN - 1.02B 27.40M 285.20M 4.27
ZOES - 251.29M -0.20M 294.10M 6.79
ZNH - 10.92B 757.40M 17.26B 33.23
ZF - - - - -
ZEN - 2.78B -106.70M 363.60M 3.09
ZBK - 6.06B - 2.46B 34.65
ZBH S&P 500 22.76B 712.00M 7.78B 50.94
Does anyone have some suggestions? I was thinking gsub in base r...