0

I am trying to check if a string contains a particular number. Example:

 mywords<- c("harry","met","sally","subway 10","1800Movies","2345") 

If i want to check if the strings have the number "1", I am expecting to have the following as result:

FALSE FALSE FALSE TRUE TRUE FALSE 

I was trying something with:

grepl("\\1", mywords) 

but it works only for letters. Thank you everyone for your help.

2
  • 5
    grepl("1", mywords) Commented May 8, 2018 at 17:29
  • oh!.. it was very easy. Thank you very much. Commented May 8, 2018 at 17:30

0

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.