Displaying 1 result from an estimated 1 matches for "containsthe".
2010 Apr 29
2
substring comparison
Hi all,
I'm writing a script to do some basic text analysis in R. Let's assume
I have a data frame named data which contains a column named 'utt'
which contains strings. Is there a straightforward way to achieve
something like this:
data$ContainsThe <- ifelse(startsWith(data$Utt,"the"),"y","n")
or
data$ContainsThe <- ifelse(contains(data$Utt,"the"),"y","n")
?
I tried using grep
data$ContainsThe <- ifelse(grep("the",data$Utt),"y","n")
but this...