Re: [R] More Columns than column names Error

2013-10-22 Thread arun
Hi, The "Garbage.txt" file you showed in the original post is slighly different (in spacing) from the one you are showing now. lines1 <- readLines("Garbage.txt",warn=FALSE) lines2 <- readLines("GarbageNew.txt",warn=FALSE) #saved the new as "GarbageNew.txt" lines1  [1] "Material\tWeight(Millio

Re: [R] More Columns than column names Error

2013-10-22 Thread arun
Hi, Try:  lines1 <- readLines("Garbage.txt",warn=FALSE) dat1 <- read.table(text=gsub("\t+","\t",lines1),stringsAsFactors=FALSE,sep="\t",check.names=FALSE,header=TRUE)  str(dat1) #'data.frame':    10 obs. of  3 variables: # $ Material    : chr  "Food Scraps" "Glass" "Metals" "Paper" ... # $

Re: [R] More Columns than column names Error

2013-10-22 Thread Keith Jewell
Carl is right. Going to the nabble post and looking in the source data file I see the headings row has 'Material' tab 'Weight...' tab 'Percent'. Each of the data rows has 1 tab character between the 'Material' and 'Weight' columns and 3

Re: [R] More Columns than column names Error

2013-10-22 Thread Carl Witthoft
What is the exact code you are using to try to load this file? I strongly suspect the problem is a mixture of spaces and multiple tabs in your text file. -- View this message in context: http://r.789695.n4.nabble.com/More-Columns-than-column-names-Error-tp4678770p4678787.html Sent from the R he