Skip to contents

Like Excel vlookup/grep, both both ways

Usage

partial_vlookup(pattern, lookup_vector)

Arguments

pattern

The pattern to compare.

lookup_vector

The dictionnary in which to look for the pattern.

Examples

address <- c(
  "Department of Psychology, Cornell University, Ithaca, New York 14853-7601.",
  "Dipartimento di Psicologia Generale, Università di Padova, Italy.",
  "Universität Mannheim, Federal Republic of Germany.",
  "Département de psychologie, Université du Québec à Montréal, Canada."
)
partial_vlookup(address, universities$university)
#> [1] "Cornell University" NA                   NA                  
#> [4] NA                  
uni <- c(
  "Cornell University", "Università di Padova",
  "Universität Mannheim", "Université du Québec à Montréal"
)
partial_vlookup(uni, universities$university)
#> [1] "Cornell University" NA                   NA                  
#> [4] NA