A function that mimics excels vlookup, but for R's dataframe.

vlookup(lookup_vector, df, match_var, return_var)

Arguments

lookup_vector

A vector of items to look up.

df

The dataframe to search.

match_var

The column name to search in the dataframe.

return_var

The column of data to return when matched.

Value

A vector that contains the items of interest.

Details

A function that works like the VLOOKUP function in excel. This function was borrowed from https://www.r-bloggers.com/an-r-vlookup-not-so-silly-idea/.

See also

Examples

# NOT RUN {
if(interactive()){
 #EXAMPLE1
 }
# }