R/MATCH.R

Defines functions MATCH

Documented in MATCH

# MATCH Function from Excel
#' Basic MATCH function from excel
#'
#' It acts similiarly to Excel's MATCH function. It matches the value in the array.
#'
#' @param lookup_value what value to lookup
#' @param lookup_array Where should it lookup the value
#' @import base
#' @export
#' @examples
#' MATCH("virginica",iris$Species)
#' @return This example gives us the first index of an array where Species is virginica. Function will always return numeric.

MATCH <-
function(lookup_value,lookup_array){

  which(lookup_array == lookup_value)[1]

}

Try the ExcelFunctionsR package in your browser

Any scripts or data that you put into this service are public.

ExcelFunctionsR documentation built on July 1, 2020, 8:35 p.m.