Getting Match of an Element within a Vector in R Programming – charmatch() Function Last Updated : 23 Dec, 2021 Improve Improve Like Article Like Save Share Report charmatch() function in R Programming Language is used to find matches between two arguments. Syntax: charmatch(x, table, nomatch = NA_integer_) Parameters: x: the values to be matched table: the values to be matched against nomatch: the integer value to be returned at non-matching position r – charmatch() Function Example Example 1: R # R program to illustrate # charmatch function # Calling the charmatch() function charmatch("Geeks", c("Geeks", "forGeeks")) charmatch("for", c("Geeks", "forGeeks")) charmatch("forGeeks", c("Geeks", "forGeeks", "GeeksforGeeks")) charmatch("GeeksforGeeks", c("Geeks", "forGeeks", "GeeksforGeeks")) Output : [1] 1 [1] 2 [1] 2 [1] 3 Example 2: R # R program to illustrate # charmatch function # Calling the charmatch() function charmatch("an", "sand") charmatch("and", "sand") charmatch("sand", "sand") Output: [1] NA [1] NA [1] 1 Like Article Suggest improvement Previous Calculate the difference between Consecutive pair of Elements of a Vector in R Programming - diff() Function Next Convert Character value to ASCII value in R Programming - charToRaw() Function Share your thoughts in the comments Add Your Comment Please Login to comment...