Skip to content

Instantly share code, notes, and snippets.

@toyeiei
Last active August 15, 2019 07:44
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save toyeiei/3592948e2856be6c619e8cd889dd8879 to your computer and use it in GitHub Desktop.
Save toyeiei/3592948e2856be6c619e8cd889dd8879 to your computer and use it in GitHub Desktop.
R4Excel - vlookup in R
## read a lookup table into R
lookup_state <- read.csv("lookup_table.csv")
## filter only US students
df_us <- filter(df, nationality == "US")
## we can use left_join to do vlookup in R
df_us %>%
left_join(lookup_state, by = c("id" = "us_students")) %>%
slice(1:10)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment