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

Petr PIKAL petr.pikal at precheza.cz
Fri Oct 22 09:25:42 CEST 2010


Hi

You did not provide much info for help. What is size of imported file 
(columnsxrows)?

r-help-bounces at r-project.org napsal dne 22.10.2010 01:23:03:

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

Imports fine or not?

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

It seems that this file have no header or the header are numbers from 1 to 
16345

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

There are many ways how to import whole file by read.* commands but you 
could also check scan or readLines functions. The result always depends on 
looklike of your input file (separators, decimals, missing values etc.)

Regards
Petr

> 
> Thanks!
> -- 
> View this message in context: 
http://r.789695.n4.nabble.com/importing-csv-
> gets-me-all-16-000-columns-with-NA-tp3006480p3006480.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