Skip to content
Prev 157515 / 398506 Next

turning comma separated string from multiple choices into flags

June Kim wrote:
I'd look into something like as.data.frame(lapply(strings, grep,
x=favorite_magazine, fixed=TRUE)), where strings <- c("Fast Company",
"Havard Business Review", ...).

(I take it that the mechanism is such that you can rely on at least
having everything misspelled in the same way? If it is alternatingly
"Havard" and "Harvard", then things get a bit trickier.)