Reputation: 5
I have a column showing total assets of some people in Rs 3,94,24,827 ~ 3 Crore+ this format. I want this column to show only numeric data i.e. 39400000 for the above value and same for every row. How to do this in R.
Upvotes: 0
Views: 217
Reputation: 79318
What if you try something like
text=“Rs 3,94,24,827 ~ 3 Crore+”
gsub(“\\D”,””,gsub(“,[2].+”,”00000”,text))
[1] “39400000”
To obtain the number alone;
gsub(“(~.*)|\\D”,””,text)
[1]”39424827”
Upvotes: 1