Im trying to compare marital status and my variables have names of "married", "not married", "engaged", "single", and "nota married". How would I make this data only read as "married" and "not married"? (engaged counting as married, single and nota single counting as not married)
Sample dataset
data.frame(mstatus = sample(x = c("married",
"not married",
"engaged",
"single",
"not married"),
size = 15, replace = TRUE))
This is what I have so far
df2 <- df%>%mutate(
mstatus = (tolower(mstatus))
)