I'm trying to build a function using mutate inside. The code is as follows
pre_process_corpora <- function(data, column, new_column){
data %>% mutate(new_column = tolower(column))
}
However, when running the function, I got below error and I still could not figure out why.
Error in eval(lhs, parent, parent) : object 'x' not found
I was also trying to do another way to build a function with below syntax
data$new_column <- tolower(data$column)
However, I received below error message
$ operator is invalid for atomic vectors
Any tip / insight is much appreciated!