Message-ID: <50F9A926.8070406@sapo.pt>
Date: 2013-01-18T19:57:26Z
From: Rui Barradas
Subject: columns called X rename Y
In-Reply-To: <CAMn86Nc1iZU1E=WyddNv=hSLAaAGHK1zar2Vx1ocLHQMrDzNiA@mail.gmail.com>
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 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.
>