Location via proxy:   [ UP ]  
[Report a bug]   [Manage cookies]                

Check If a String is a Subset of Another String in R



To check whether a string is a subset of another string we can use grepl function.

Example

> Company <- "TutorialsPoint"
> Job <- "Tutor"
> grepl(Job, Company, fixed = TRUE)
[1] TRUE

Here we are getting TRUE because Tutor is a subset of TutorialsPoint.

> grepl(Company, Job, fixed = TRUE)
[1] FALSE

Here we are getting FALSE because TutorialsPoint is not a subset of Tutor.

Updated on: 2020-07-06T14:27:52+05:30

1K+ Views

Kickstart Your Career

Get certified by completing the course

Get Started
Advertisements