Dear all,

I have different data frames for which I would like to modify names of each
column such that the new name would include the name of the first column
added to the name of other columns; I came up with the following code.
Nothing changes when I run the following code. I would be grateful if
someone could help me.

All the best,
-Arman

rename_columns <- function(dataset) {
for (i in 2:(ncol(dataset))) {names(dataset)[i] <- paste(names(dataset)[1],
names(dataset)[i], sep="_")
}
}

rename_columns(dataset) %nothing happens!

        [[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.

Reply via email to