[R] columns called X rename Y
ruipbarradas at sapo.pt
Fri Jan 18 20:57:26 CET 2013
Try the following.
names(seba)[grep("numbers", names(seba))] <- "b"
names(seba)[grep("constant", names(seba))] <- "c"
Hope this helps,
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
> For example:
>> seba <- data.frame ('constant' = 3, 'numbers' = 1: 10, 'letters' = LETTERS
> [1:10], otros = 2:11)
> List their names:
>> names (Seba)
>  "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,
> [[alternative HTML version deleted]]
> R-help at 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