Search notes:

R function: match

Match returns the index of the first element in a vector with a specific value:
n <- c( 11, 18, 7, 38, 42, 98, 66, 7, 18, 42, 56, 13) 

match(42, n)
#
# [1] 5
Github repository about-r, path: /functions/match/first-pos.R
It also possible to look-up the values of a vector in another vector:
values <- c('one', 'two', 'three', 'four', 'five', 'four', 'three', 'two', 'one');
words  <- c('five', 'two', 'four')

match(words, values);
#
#  5 2 4
Github repository about-r, path: /functions/match/vector.R

See also

which(…) returns the indices in a logical vector that are TRUE.
The %in% operator is defined as "%in%" <- function(x, table) match(x, table, nomatch = 0) > 0.
Index to (some) R functions

Index

Fatal error: Uncaught PDOException: SQLSTATE[HY000]: General error: 8 attempt to write a readonly database in /home/httpd/vhosts/renenyffenegger.ch/php/web-request-database.php:78 Stack trace: #0 /home/httpd/vhosts/renenyffenegger.ch/php/web-request-database.php(78): PDOStatement->execute(Array) #1 /home/httpd/vhosts/renenyffenegger.ch/php/web-request-database.php(30): insert_webrequest_('/notes/developm...', 1758201148, '216.73.216.150', 'Mozilla/5.0 App...', NULL) #2 /home/httpd/vhosts/renenyffenegger.ch/httpsdocs/notes/development/languages/R/functions/match(58): insert_webrequest() #3 {main} thrown in /home/httpd/vhosts/renenyffenegger.ch/php/web-request-database.php on line 78