0

I can use the following code to change the name in the cells in my data.frame:

df$column <- gsub("Old name", "New name", df$column)

However, I want to create it as a function. I have tried with the following, but it does not work:

changename <- function(data) {
  data$column <- gsub("Old name", "New name", data$column)
}

changename(df)

What do I do wrong?

Michael
  • 565
  • 4
  • 11

0 Answers0