[R] help with replacing all comma in a data frame with a dot

From: Tom Cohen <tom.cohen78_at_yahoo.se>
Date: Wed, 23 Jan 2008 16:30:15 +0100 (CET)


Dear list,    

  I have imported a spss data file in R, where a comma is used to separate the decimal numbers, e.g. 3,567 instead of 3.567 as in R. How can I replace the comma with a dot for all values in the data frame    

>kk

                            a            b     c  d         e    f
1  ,0925199910320613  82523  8  ,855  ,803  ,69
2   ,278314161923372  91657 26 1,285 1,032 ,823
3   ,278314161923372  91657 26 1,285 1,032 ,823
4   ,278314161923372  91657 26 1,285 1,032 ,823
5   ,278314161923372  91657 26 1,285 1,032 ,823
6   ,278314161923372  91657 26 1,285 1,032 ,823
7   ,203740581833404  72026 94  ,479    ,3 ,061
8   ,243694169416943  23684 77 1,375  ,437 ,054
9                 ,3  21857 86  ,829  ,315 ,029
10                ,6 111569 93  ,764    ,4 ,076
11                ,6 111569 93  ,764    ,4 ,076
12                ,6 111569 93  ,764    ,4 ,076
13        ,419788431  35744 95   ,44  ,298 ,076
14        ,419788431  35744 95   ,44  ,298 ,076
16         ,39266161  29098 90  ,361  ,256 ,076
17         ,39266161  29098 90  ,361  ,256 ,076
18        ,691736472  40135 85  ,864  ,284  ,09
19        ,691736472  40135 85  ,864  ,284  ,09
20        ,442407817  48673 86   ,44  ,279 ,088
24 ,0925199910320613 22482 64 ,104 ,082 ,054

  Thanks in advance,
  Tom        



Sök efter kärleken!

        [[alternative HTML version deleted]]



R-help_at_r-project.org mailing list
https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide http://www.R-project.org/posting-guide.html and provide commented, minimal, self-contained, reproducible code. Received on Wed 23 Jan 2008 - 15:54:05 GMT

Archive maintained by Robert King, hosted by the discipline of statistics at the University of Newcastle, Australia.
Archive generated by hypermail 2.2.0, at Wed 23 Jan 2008 - 20:30:08 GMT.

Mailing list information is available at https://stat.ethz.ch/mailman/listinfo/r-help. Please read the posting guide before posting to the list.

list of date sections of archive