Hello,

Try the following.


names(seba)[grep("numbers", names(seba))] <- "b"
names(seba)[grep("constant", names(seba))] <- "c"

names(seba)


Hope this helps,

Rui Barradas

Em 18-01-2013 18:14, Sebastian Kruk escreveu:
I have a data. frame to which you want to change the names to some of their
columns.

For example:

seba <- data.frame ('constant' = 3, 'numbers' = 1: 10, 'letters' = LETTERS
[1:10], otros = 2:11)

List their names:

names (Seba)
[1] "constant" "numbers" "letters"

I want to rename c the column called constant and b the column
called numbers.

I do not know in which order appear names.

How could do it?

Thanks in advance,

Sebastian.

        [[alternative HTML version deleted]]

______________________________________________
R-help@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@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.

Reply via email to