I have a column of comments called MMR_notes. In the MMR_notes there should be a the word good, okay or bad. For each row that has a comment that includes the word/pattern "bad", "okay" or "good" I would like a "1", "2" and "3" to be entered into another column called quality respectively. Here is the code I've been trying to use so far.
The image shows a table of what I'm hoping the result will be
if (grep(DATA$MMR_notes=="*bad*")){
print(1,DATA$quality)
} else if (grep( DATA$MMR_notes=="*good*")) {
print(3,DATA$quality)
} else if (grep( DATA$MMR_notes=="*okay*")) {
print(2,DATA$quality)
} else {
print("Na")
}
Aucun commentaire:
Enregistrer un commentaire