[R] import csv file into R, strange problem

Rainer M Krug r.m.krug at gmail.com
Wed Sep 14 10:42:44 CEST 2011


On Wed 14 Sep 2011 10:37:46 CEST, Uwe Ligges wrote:
>
>
> On 14.09.2011 10:28, Rainer M Krug wrote:
>> -----BEGIN PGP SIGNED MESSAGE-----
>> Hash: SHA1
>>
>> On 13/09/11 18:08, bonnieyuan wrote:
>>> Hi, I used read.csv(file name, header=T, sep=",") to bring in a csv
>>> file I saved in MS Excel. The strange thing is all the data ended
>>> up in one big column. The number of rows match with the number of
>>> observations, but all the variables got squeezed into one column.
>>> Also the first row where the header is, the variables names have a
>>> dot between them, replacing the comma that's in the original csv
>>> file.
>>>
>>> What did I do wrong here?
>>
>> Maybe Microsoft? We had the problem in South Adfrica, that if the
>> locale was set to South African English, then the csv was ";"
>> seperated - don't tell me why.
>
> Probably MS expects that South Africans, like Germans, use a comma ","
> as the decimal "point", and hence the separator is ";". That's why
> read.csv2() is available - reading that pseudo comma separated format..

Good to know - I should have known that at that time - it caused me 
several headaches.

Rainer
>
> Uwe Ligges
>
>
>>
>> So: check your csv if it is really a csv.
>>
>> Cheers,
>>
>> Rainer
>>
>>
>>>
>>> -- View this message in context:
>>> http://r.789695.n4.nabble.com/import-csv-file-into-R-strange-problem-tp3810470p3810470.html
>>>
>>>
>>>
>> Sent from the R help mailing list archive at Nabble.com.
>>>
>>> ______________________________________________ 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.
>>
>>
>> - -- 
>> Rainer M. Krug, PhD (Conservation Ecology, SUN), MSc (Conservation
>> Biology, UCT), Dipl. Phys. (Germany)
>>
>> Centre of Excellence for Invasion Biology
>> Stellenbosch University
>> South Africa
>>
>> Tel :       +33 - (0)9 53 10 27 44
>> Cell:       +33 - (0)6 85 62 59 98
>> Fax :       +33 - (0)9 58 10 27 44
>>
>> Fax (D):    +49 - (0)3 21 21 25 22 44
>>
>> email:      Rainer at krugs.de
>>
>> Skype:      RMkrug
>> -----BEGIN PGP SIGNATURE-----
>> Version: GnuPG v1.4.11 (GNU/Linux)
>> Comment: Using GnuPG with Mozilla - http://enigmail.mozdev.org/
>>
>> iEYEARECAAYFAk5wZZEACgkQoYgNqgF2egqGfgCeKWohnNQONvSge1M6Bf9OtBMP
>> ln4An1n64fYAwNfTzc3rbD/tRXx9ksry
>> =XYvm
>> -----END PGP SIGNATURE-----
>>
>> ______________________________________________
>> 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.



More information about the R-help mailing list