I have a dataframe as follows
1 Tertiary seen.
2 No tertiary seen.
3 No anything seen.
4 Tertiary everywhere.
I want to add a column only when Tertiary is seen but not when the regex No.*\. is seen.
1 Tertiary seen. Tertiary
2 No tertiary seen. NA
3 No anything seen. NA
4 Tertiary everywhere. Tertiary
I know I can use |
in str_extract but & doesn't seem to be accepted as follows
Mydata$newcol<-str_extract(Mydata$Text,"[Tt]ertiary&!No.*[Tt]ertiary\\.")