Tom Cohen wrote: > 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 > How did you read the data in the first place (not by read.spss, I expect)?
This is usually more conveniently done on input via the dec= argument to read.table(), or the dedicated delimited-file readers. > > >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@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. > -- O__ ---- Peter Dalgaard Øster Farimagsgade 5, Entr.B c/ /'_ --- Dept. of Biostatistics PO Box 2099, 1014 Cph. K (*) \(*) -- University of Copenhagen Denmark Ph: (+45) 35327918 ~~~~~~~~~~ - ([EMAIL PROTECTED]) FAX: (+45) 35327907 ______________________________________________ R-help@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.