On Jan 18, 2013, at 3:13 PM, Jeff Newmiller wrote:
> If you have a lot of names to change, or you need to do it regularly, you can
> use something like:
>
> renames <- read.table(text=
> "oldname newname
> constant c
> numbers b
> ", header=TRUE, as.is=TRUE )
> names(seba)[match(renames$oldname
If you have a lot of names to change, or you need to do it regularly, you can
use something like:
renames <- read.table(text=
"oldname newname
constant c
numbers b
", header=TRUE, as.is=TRUE )
names(seba)[match(renames$oldname, names(seba))] <- renames$newnames
--
013 18:14
To: R-help
Subject: [R] columns called X rename Y
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 the
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
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
5 matches
Mail list logo