KnowledgeHub
Questions
Tags
Users
Search
Alex Rivera
|
Logout
Edit Question
Title
Body
I need to replace the levels of a factor column in a dataframe. Using the iris dataset as an example, how would I replace any cells which contain virginica with setosa in the Species column? I expected the following to work, but it generates a warning message and simply inserts NAs: iris$Species[iris$Species == 'virginica'] <- 'setosa'
Tags (comma-separated)
Save Edits
Cancel