fritzz
fritzz

Reputation: 31

How can I change the variable(column) names in R?

How can I change the variable(column) names in R? I couldn't do it with plyr package or any other data manipulation R package.

Upvotes: 0

Views: 9043

Answers (2)

Denis Rasulev
Denis Rasulev

Reputation: 4079

You can also make it like this:

df <- data.frame("1", "b", "test")
names(df) <- c("Name 1", "Name 2", "Name 3")

Upvotes: 1

CuriousBeing
CuriousBeing

Reputation: 1632

If you want to change the column names:

colnames(DataFrame)[colnames(DataFrame)=="Old Column Name"] <- "New Column Name"

Upvotes: 0

Related Questions