match Function in R (Example)

This page illustrates how to apply the match function in the R programming language.

Example Data

We use the following numeric vector as example data:

x <- c(3, 3, 3, 1, 3, 2, 5, 7)    # Create example vector

Example: Application of match Function

We can identify the position of the value 1 within our example vector as follows:

match(1, x)                       # Apply match function
# 4

Leave a Reply

Your email address will not be published. Required fields are marked *

Fill out this field
Fill out this field
Please enter a valid email address.
You need to agree with the terms to proceed

Menu
Top