A couple of options. It's best to just replace it; it's nice and clean:
iris2$Species[iris2$Species == 'setosa'] <- 'regular'
ifelsereturns a vector, so the way to use it in such cases is to replace the column with a new one ifelse. Do not complete the assignment inside ifelse!
iris2$Species <- ifelse(iris2$Species=='setosa', 'regular', iris2$Species)
But there is no need to use ifelseif else remains unchanged. - It is better to replace the direct replacement of the subset (the first line of code in this answer).
New factor levels
, - , iris$Species factor () , 'regular' . - character :
iris2$Species <- as.character(iris2$Species)
iris2$Species[iris2$Species == 'setosa'] <- 'regular'
( ), , .
, , attach. , , . ( , , , , attach.)