Re: [R] remove column names from a data frame

From: Henrique Dallazuanna <wwwhsd_at_gmail.com>
Date: Mon, 18 Feb 2008 16:49:31 -0300

Try this:

names(df) <- NA

or

names(df) <- make.names(seq(ncol(df)))

On 18/02/2008, joseph <jdsandjd_at_yahoo.com> wrote:
>
>
> I want to remove the column names from a data frame. I do
> it the long way, can any body show me a better way ?
>
>
> df= data.frame(chrN= c("chr1", "chr2", "chr3"), start= c(1,
> 2, 3), end= c(4, 5, 6), score= c(7, 8, 9))
>
>
> df
>
>
> #I write a txt file without row or column names
>
>
> write.table(df,"df1.txt",sep='\t',quote=FALSE,row.names=F,col.names=F)
>
>
> #then I read it with the header = F to obtain the format
> I want
>
>
> df1=read.table("df1.txt", header = F)
>
>
> df1
>
>
> ____________________________________________________________________________________
> Looking for last minute shopping deals?
>
> /category.php?category=shopping
> [[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

______________________________________________
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.
Received on Mon 18 Feb 2008 - 19:51:45 GMT

Archive maintained by Robert King, hosted by the discipline of statistics at the University of Newcastle, Australia.
Archive generated by hypermail 2.2.0, at Mon 18 Feb 2008 - 20:30:15 GMT.

Mailing list information is available at https://stat.ethz.ch/mailman/listinfo/r-help. Please read the posting guide before posting to the list.

list of date sections of archive