> -----Original Message-----
> From: r-help-boun...@r-project.org [mailto:r-help-boun...@r-project.org]
> On Behalf Of William Dunlap
> Sent: Wednesday, July 11, 2012 4:23 PM
> To: F86; r-help@r-project.org
> Subject: Re: [R] HELP me please with import of csv to R
> 
> You or nabble left out my suggestion to use dec="," in your
> call to read.table (or read.csv, etc.)
> 
>   Did you use read.table(filename, ..., dec=",") when importing
>   the data (so "30,3" is read as the number 30 and 3 tenths instead
>   of as the character string "30,3")?
> 
> along with an example of what it did:
> 
>   > good <- read.table(header=TRUE, dec=",", text="x y\n1,1 2,1\n1 2\n")
>   > str(good)
>   'data.frame':   2 obs. of  2 variables:
>    $ x: num  1.1 1
>    $ y: num  2.1 2
> 
> Bill Dunlap
> Spotfire, TIBCO Software
> wdunlap tibco.com
> 
> 
> > -----Original Message-----
> > From: r-help-boun...@r-project.org [mailto:r-help-boun...@r-project.org]
> On
> > Behalf Of F86
> > Sent: Wednesday, July 11, 2012 2:47 PM
> > To: r-help@r-project.org
> > Subject: Re: [R] HELP me please with import of csv to R
> >
> > Hello William,
> >
> > - I used str()  and got this
> >
> > 'data.frame':       290 obs. of  2 variables:
> >  $ Kommuner: Factor w/ 289 levels "Ale","Alingsas",..: 34 40 44 79 95 99
> 132
> > 162 169 173 ...
> >  $ Skatt   : Factor w/ 177 levels "28,89","28,9",..: 86 7 47 67 74 25 24
> 23
> > 85 74 ...
> >
> >  - and summary()
> >
> >  - got this
> >
> >
> >  summary(skatter)
> >      Kommuner       Skatt
> >  Habo    :  2   33,4   :  9
> >  Ale     :  1   31     :  6
> >  Alingsas:  1   32,45  :  6
> >  Almhult :  1   32     :  5
> >  Alvdalen:  1   32,15  :  5
> >  Alvesta :  1   33,2   :  5
> >  (Other) :283   (Other):254
> >
> >
> >
> > So obviously i have done something wrong. Do you know how i get it
> right?
> >
> >
> > Thanks!
> >

And in an earlier post in this thread, Peter Dalgaard had pointed out the 
existence of read.csv2 for just this purpose.

Dan

Daniel Nordlund
Bothell, WA USA
 

______________________________________________
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.

Reply via email to