[R] Simple question about error on CSV import

esawdust landon at 360vl.com
Tue Sep 1 18:07:38 CEST 2009



esawdust wrote:
> 
> Here's the contents of a simple test2.csv CSV file:
> 
> #,Status,Project  
> 5842,New,Test
> 
>> snortalerts = read.table( "/Users/lcox/Documents/test2.csv", header=TRUE,
>> sep=",", row.names="#")
> Error in data[[rowvar]] : attempt to select less than one element
> 
> Landon
> 

Figured out the answer, though it wasn't obvious (to me anyway).  The symbol
"#" used as the first column label was the problem.   I changed that to be
"id" and changed the read.table to be:

snortalerts <- read.table( "/Users/lcox/Documents/test2.csv", header=TRUE,
sep=",", row.names="id")

and it worked fine.  
-- 
View this message in context: http://www.nabble.com/Simple-question-about-error-on-CSV-import-tp25242899p25243159.html
Sent from the R help mailing list archive at Nabble.com.




More information about the R-help mailing list