Rfast (version 1.7.3)

Find element: Find element

Description

Find element.

Usage

is_element(x, key)

Arguments

x
A vector or matrix with the data.
key
A value to check if exists in the vector x.

Value

Search if the v exists in x linear time. Then returns TRUE/FALSE if the value is been found.

Details

The functions is written in C++ in order to be as fast as possible.

See Also

binary_search (buit-in R function)

Examples

Run this code
x <- rnorm(10000)
key <- x[500]
system.time( b <- is_element(x,key) )

Run the code above in your browser using DataCamp Workspace