Hi,

I'm trying to create a new variable using the following code:

A$B2<-ifelse(A$B %in% "EDUCATION","EDUCATION",NA)

The problem is, I want the new variable to be labeled "EDUCATION" if the original *contains* "EDUCATION", not of it is an exact match. I've done a lot of searching on wild cards and the like, and the only function I've found that does this kind of matching is grep(), which I don't think I can use here, since it subsets the original data.

Any ideas?

Thanks!

______________________________________________
R-help@r-project.org mailing list
https://stat.ethz.ch/mailman/listinfo/r-help
PLEASE do read the posting guide http://www.R-project.org/posting-guide.html
and provide commented, minimal, self-contained, reproducible code.

Reply via email to