[R] col headers in read.table()

Henrique Dallazuanna wwwhsd at gmail.com
Thu Sep 24 21:37:41 CEST 2009


Try this;

mat <- read.table('test.txt',header=T,row.names=1,sep='\t', check.names = FALSE)

On Thu, Sep 24, 2009 at 2:25 PM, Tim Smith <tim_smith_666 at yahoo.com> wrote:
> Hi,
>
> I was trying to read in a file test.txt, which has the following data:
>  norm   norm    norm    class   class   class
> a       1       2       3       4       5       6
> b       3       4       5       6       7       8
> c       5       6       7       8       9       10
>
>
> in my R code, I do the following:
> ---------------------------------------------------
>> mat <- read.table('test.txt',header=T,row.names=1,sep='\t')
>> mat
>
>  norm norm.1 norm.2 class class.1 class.2
> a    1      2      3     4       5       6
> b    3      4      5     6       7       8
> c    5      6      7     8       9      10
>>
> --------------------------------------------------
> What do I need to do so that I don't get 'norm.1', 'norm.2' etc., but just 'norm', 'norm'..,i.e. without the numbers.
> thanks,
>
>
>
>        [[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.
>



-- 
Henrique Dallazuanna
Curitiba-Paraná-Brasil
25° 25' 40" S 49° 16' 22" O




More information about the R-help mailing list