[R] How to clear colnames?

Daniel Malter daniel at umd.edu
Tue Oct 27 23:28:15 CET 2009


x=rnorm(100)
y=rnorm(100)
mydata=data.frame(x,y)
names(mydata)=("I.am.x","I.am.y")
head(mydata)
names(mydata)=c(NULL,NULL)
head(mydata)
names(mydata)

They technically don't exist if you null them.

Daniel

-------------------------
cuncta stricte discussurus
-------------------------

-----Ursprüngliche Nachricht-----
Von: r-help-bounces at r-project.org [mailto:r-help-bounces at r-project.org] Im
Auftrag von Benilton Carvalho
Gesendet: Tuesday, October 27, 2009 6:21 PM
An: Peng Yu
Cc: r-help at stat.math.ethz.ch
Betreff: Re: [R] How to clear colnames?

colnames(x) <- NULL

On Oct 27, 2009, at 8:09 PM, Peng Yu wrote:

> I only see how to assign values to colnames() in help. Is there a way 
> to remove colnames?
>
> colnames(x) <- value
>
> ______________________________________________
> 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.

______________________________________________
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.




More information about the R-help mailing list