[R] RES: Change name of a specific column of a data frame

Leandro Marino leandro at cesgranrio.org.br
Tue Jul 1 21:36:25 CEST 2008

You can use names(database)[position]

where position is the number of the column that you want to rename!

Leandro Marino

-----Mensagem original-----
De: r-help-bounces em r-project.org [mailto:r-help-bounces em r-project.org]Em
nome de naw3 em duke.edu
Enviada em: terca-feira, 1 de julho de 2008 16:18
Para: R-help em r-project.org
Assunto: [R] Change name of a specific column of a data frame


Sorry for the simple question. Is there a way to change the name of only one
column of an existing data frame?

I know colnames allows you to set the name of all the columns, but only one
column in the middle of my data frame needs a new name.


R-help em r-project.org mailing list
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