R/multimatch.R

multimatch <- function(query, target, values, sep = ",", use.unique = TRUE) {
  stopifnot(length(values) == length(target))
  if (use.unique) return(sapply(1:length(query), function(ii) return(paste(unique(values[target == query[ii]]), collapse = sep))))
  if (!use.unique) return(sapply(1:length(query), function(ii) return(paste(values[target == query[ii]], collapse = sep))))
  return(invisible(NULL)) # this should never happen
}  

  

Try the gtx package in your browser

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

gtx documentation built on May 2, 2019, 5:08 a.m.