[R] importing csv gets me all 16,000 columns with "NA"

Gabor Grothendieck ggrothendieck at gmail.com
Fri Oct 22 15:31:12 CEST 2010


On Thu, Oct 21, 2010 at 7:23 PM, mkinseth <mkinseth at projects.sdsu.edu> wrote:
>
> I'm new to R. I have a mac (OS10.6). I have converted an Excel file to a csv
> to import into R. I have used many methods to import the file, most do not
> work, the best so far is:
>
> filename <- read.csv(/Users/Desktop/csvfile.csv", header=T, sep=","). I have
> also tried taking out the header and sep lines and it still imports fine.
>
> Regardless of what I do, it always brings in the data but also includes all
> 16,000+ columns from Excel with X.1 as the first column up to X.16345 (for
> instance). Of course the files are filled with "NA" since no data is
> present.
>
> How do I get around this?
>
> So far I have included strip.white=T and fill=T, something I've seen in
> other csv import posts but this does not work.
>
> Thanks!

It might be that the content of your spreadsheet is not what you think
it is.  You
might want to try reading it from Excel using one of the methods
listed in this link
in case the problem arose through the creation of the intermediate csv file:

http://rwiki.sciviews.org/doku.php?id=tips:data-io:ms_windows

-- 
Statistics & Software Consulting
GKX Group, GKX Associates Inc.
tel: 1-877-GKX-GROUP
email: ggrothendieck at gmail.com



More information about the R-help mailing list