[R] Replacing a period in a string

2010-12-02 Thread Luis Felipe Parra
Hello I have a sting of the form 12.084.547,17 which I would like R to understand as a number which has , as the decimal separator, does anybody know how to do this? thank you Felipe Parra [[alternative HTML version deleted]] __

Re: [R] Replacing a period in a string

2010-12-02 Thread David Winsemius
On Dec 2, 2010, at 10:46 PM, Luis Felipe Parra wrote: Hello I have a sting of the form 12.084.547,17 which I would like R to understand as a number which has , as the decimal separator, does anybody know how to do this? If that is in a file then read.csv2 is the answer. If it is in a

Re: [R] Replacing a period in a string

2010-12-02 Thread Earl F Glynn
What about this? Remove the periods and change the , to a .: s - 12.084.547,17 x - as.numeric(gsub(',','\\.', gsub('\\.','',s))) options(digits=10) x Escaping periods is not-so-obvious. efg Earl F Glynn Overland Park, KS Luis Felipe Parra wrote: Hello I have a sting of the form