[R] Problems understanding use of regular expression (in gsub) for manipulating currency
    jim holtman 
    jholtman at gmail.com
       
    Thu Nov 22 04:27:57 CET 2012
    
    
  
Here is another approach:
> x <- "\"$ 1,200,300,400.50\""
>  x
[1] "\"$ 1,200,300,400.50\""
> gsub("[,$ \"]", "", x)
[1] "1200300400.50"
> as.numeric(gsub("[,$ \"]", "", x))
[1] 1200300401
>
On Wed, Nov 21, 2012 at 4:41 PM, Mauricio Cornejo
<mauriciocornejo at yahoo.com> wrote:
> x <- "\"$ 1,200,300,400.50\""
-- 
Jim Holtman
Data Munger Guru
What is the problem that you are trying to solve?
Tell me what you want to do, not how you want to do it.
    
    
More information about the R-help
mailing list