This is a case where you need to provide a sample of your data. Most likely it is not in a format that read.table can read with the parameters you have given it. It may have different field separators, it might have "#" in data fields, you might have unbalanced quotes, etc. So it is a problem in your data and the way you are trying to read it. You have to include commented, minimal, self-contained, reproducible code.
On Fri, Apr 13, 2012 at 10:28 AM, AMFTom <the.quiet.r...@gmail.com> wrote: > Dear Thierry, > > Thanks for your help. Now though, I try to import data from a txt file, and > it says either > > > mydataframe <- read.table("Lv2.8.txt") > Error in scan(file, what, nmax, sep, dec, quote, skip, nlines, na.strings, > : > line 3 did not have 15 elements > > or > > > mydataframe <- read.table("Lv2.8.txt", header = TRUE) > Error in read.table("Lv2.8.txt", header = TRUE) : > more columns than column names > > even though I seem to have put a column name into the txt file for each > column. Any ideas? > > Thanks again! > > Tom > > -- > View this message in context: > http://r.789695.n4.nabble.com/Help-Importing-data-from-txt-and-xlsx-files-tp4554622p4555001.html > Sent from the R help mailing list archive at Nabble.com. > > ______________________________________________ > R-help@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. > -- Jim Holtman Data Munger Guru What is the problem that you are trying to solve? Tell me what you want to do, not how you want to do it. [[alternative HTML version deleted]] ______________________________________________ R-help@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.