Hello everybody, I'm a new user and I'm trying to use read.table with a tab delimited file but the system tells me (i) that there are more columns than column names, and (ii) that headers and col.names are of different lengths. I have already checked my variable names and there's no blank spaces. However, some variables have quite long names such as "valoracion.experiencias.segundo.year". Could it be the problem? If that is the case, I still don't understand why I have more columns that column names. Could anyone help me with that? Thank you very much! Joan-Josep Vallbé Institute of Law and Technology Political Science Department Autonomous University of Barcelona (UAB) pep.vallbe@uab.es [[alternative HTML version deleted]]
> I'm a new user and I'm trying to use read.table with a tab delimited > file but the system tells me (i) that there are more columns than > column names, and (ii) that headers and col.names are of different > lengths. I have already checked my variable names and there's no blank > spaces. However, some variables have quite long names such as > "valoracion.experiencias.segundo.year". Could it be the problem? If > that is the case, I still don't understand why I have more columns > that column names. Could anyone help me with that?It is unlikely to be due to the long variable names. Without seeing your data, it is impossible to say for sure what the problem is, but here are some things to check. Have you set the 'sep' argument to "\t"? Otherwise read.table may get confused and interpret tabs as multiple spaces. Alternatively, use read.delim, which is a wrapper for read.table made especially for tab delimited files. Are there any tabs at the ends of lines? Are there any text variables with spaces, that aren't enclosed on quotes? Regards, Richie. Mathematical Sciences Unit HSL ------------------------------------------------------------------------ ATTENTION: This message contains privileged and confidential inform...{{dropped:20}}
Joan-Josep Vallb? <pep.vallbe <at> uab.cat> writes:> I'm a new user and I'm trying to use read.table with a tab delimited > file but the system tells me (i) that there are more columns than > column names, and (ii) that headers and col.names are of different > lengths. I have already checked my variable names and there's no blank > spaces. > However, some variables have quite long names such as > "valoracion.experiencias.segundo.year". Could it be the problem?I am sure you tried removing the first line and using header =FALSE, because that is faster than writing a message> If that is the case, I still don't understand why I have more columns > that column names.Use an editor that shows tabs explicitly. Often, there is a TRAILING tab in the data rows. Dieter
Hi, I've tried it with read.delim: ayuso <- read.delim("/Users/user/Rwork/ayusotriada.txt") and now the error message is "Error with make.names(col.names, unique = TRUE) : string multibyte 187 invalid" thanks! On 02/10/2008, at 12:21, Joan-Josep Vallb? wrote:> Hello everybody, > > I'm a new user and I'm trying to use read.table with a tab delimited > file but the system tells me (i) that there are more columns than > column names, and (ii) that headers and col.names are of different > lengths. I have already checked my variable names and there's no blank > spaces. However, some variables have quite long names such as > "valoracion.experiencias.segundo.year". Could it be the problem? If > that is the case, I still don't understand why I have more columns > that column names. Could anyone help me with that? > > Thank you very much! > > > Joan-Josep Vallb? > Institute of Law and Technology > Political Science Department > Autonomous University of Barcelona (UAB) > pep.vallbe at uab.es > > > > > > > [[alternative HTML version deleted]] > > ______________________________________________ > 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.Joan-Josep Vallb? Institute of Law and Technology Political Science Department Autonomous University of Barcelona (UAB) pep.vallbe at uab.es