I am trying to create a function in R that acts the same way as the "Reclassify" node in SPSS modeler. The function below has 3 arguments but it doesn't seem to be working and I'm not sure why.
column <- iris$Species
list.of.names <- c("setosa","versicolor")
new.name <- "some flowers"
reclassify <- function(column, list.of.names, new.name){
new.name.vec <- rep(new.name, length(list.of.names))
require(plyr)
column <- mapvalues(column, from = list.of.names, to = new.name.vec)
}
Why doesn't this change the two factor names to "some flowers" ?