Re: [R] read.table

From: Marc Schwartz <>
Date: Thu 19 Oct 2006 - 20:28:54 GMT

On Thu, 2006-10-19 at 16:10 -0400, Weiwei Shi wrote:
> hi,
> how could I let the colname be the numbers instead of "X" plus numbers
> when I use read.table. Or there is an alternative way?
> thanks

Sounds like you have imported the data, perhaps using 'header = TRUE' either without an actual header row of column names or perhaps an incomplete or improper (not syntactically valid) header row.

If you are getting X's (and not V's) pre-pended to the column names, that sounds like the result of make.names() on your data.

See ?make.names

If you don't have a header row in the imported data set, you can use the 'colnames' argument in read.table() to explicitly provide them. Just be sure to set 'header = FALSE'.

If there is a header row, but it is problematic, set 'header = FALSE' AND 'skip = 1', which will skip over the first row in the incoming file.

See ?read.table

HTH, Marc Schwartz mailing list PLEASE do read the posting guide and provide commented, minimal, self-contained, reproducible code. Received on Fri Oct 20 06:31:15 2006

Archive maintained by Robert King, hosted by the discipline of statistics at the University of Newcastle, Australia.
Archive generated by hypermail 2.1.8, at Thu 19 Oct 2006 - 21:30:11 GMT.

Mailing list information is available at Please read the posting guide before posting to the list.