[R] import csv file into R, strange problem

Greg Snow Greg.Snow at imail.org
Tue Sep 13 18:58:08 CEST 2011


It would appear that your file is not a csv file, but we cannot tell for sure without seeing an example of the data that you are reading in, can you cut and paste the first few lines of the file? Or post a link to a copy of the file.  If the data is not able to be shared, then create a new (small) file with made up data that displays the same problems (creating the example sometimes helps you fix the problem yourself) then share that file.

Also why are you specifying sep="," in read.csv? that is a bit redundant.

-----Original Message-----
From: r-help-bounces at r-project.org [mailto:r-help-bounces at r-project.org] On Behalf Of bonnieyuan
Sent: Tuesday, September 13, 2011 10:09 AM
To: r-help at r-project.org
Subject: [R] import csv file into R, strange problem

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?

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



More information about the R-help mailing list