R/match_v2l.R

Defines functions match_v2l

Documented in match_v2l

#' Matches vector entries to list (stackoverflow question 11002391)
#'
#' @param vector vector from which to match
#' @param list list vector entries should be matched to
#'
#' @return
#' @export
#'
#'
match_v2l <- function(vector, list) {

  g <- rep(seq_along(list), sapply(list, length))

  return(g[match(vector, unlist(list))])

}
nicohuttmann/pOmics documentation built on Sept. 21, 2022, 9:28 a.m.