0

How do I replace a string in Variable Y which matches with a string (in Variable X) containing a specific word?

I have job description in variable X. In Variable Y I should assign a short title "with one or two words", the object is to get only 5 titles for 30K rows of descriptions.

A code for the wording: replace in data$Y with "Sport" whenever data$Y containing "Ball" Ball could be in uper or lower case.

emilliman5
  • 5,816
  • 3
  • 27
  • 37
Feriel
  • 13
  • 4
  • 4
    Welcome to StackOverflow! Please read the info about [how to ask a good question](http://stackoverflow.com/help/how-to-ask) and how to give a [reproducible example](http://stackoverflow.com/questions/5963269). This will make it much easier for others to help you. – Sotos Jan 11 '18 at 15:37
  • 2
    Hi Feriel, could you include an example data frame, and an example of what you've tried to do so far? In a general sense, the regex function grep and grepl are what you should look into. – AodhanOL Jan 11 '18 at 15:37

0 Answers0