vlookup | R Documentation |
merge()
Implementing vlookup
in R using merge()
.
vlookup(data, lookup_table, data_col, lookup_col, lookup_value)
data |
Dataframe to |
lookup_table |
Table to lookup from, contains an identifier and a value column. |
data_col |
String. The column from data that contains the identifier. |
lookup_col |
String. The column from lookup_table that contains the identifier. |
lookup_value |
String. The column from lookup_table that contains the value. |
mydata <- data.frame(Type = rep(1:3,5), Rand = 4:6)
mytable <- data.frame(Type = 1:3, Magnitude = c("Low","Medium","High"))
vlookup(data = mydata,
lookup_table = mytable,
data_col = "Type",
lookup_col = "Type",
lookup_value = "Magnitude")
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.