Excel to R #3 – APPROXIMATE VLOOKUP in Excel to FUZZY LEFT_JOIN in R

[This article was first published on r-bloggers on Programming with R, and kindly contributed to R-bloggers]. (You can report issue about the content on this page here)
Want to share your content on R-bloggers? click here if you have a blog, or here if you don't.

excel vlookup R

Despite all the memes around Microsoft Excel, Excel is still a powerful tool for quick and fast data transformation, data preprocessing (forget about the date thing 😉 ). This post is my attempt to tell an Excel person how they can replicate some of their most frequently used operation like VLOOKUP (Fuzzy) using R. We perform VLOOKUP’s approximate match first on Excel and replicate the same task on RStudio using stringdist_left_join() Fuzzy left join from the R package {fuzzyjoin}

In this video, We go through how to use the R package {fuzzyjoin} to replicate Excel’s popular VLOOKUP feature with approximate match

Youtube: https://www.youtube.com/watch?v=3b_FQyGSdxg

Please subscribe to the channel and leave a feedback if it’s useful. It’ll really good to hear from you!

Code

library(tidyverse)
library(fuzzyjoin)


sheet <- tibble::tibble(
  Company = c("Apple Inc",
              "Apple Incorp",
              "Microsoft",
              "Google",
              "Facebook")
)


main <- tibble::tibble(
  Company = c("Apple Inc",
              "Microsoft",
              "Google",
              "Facebook Inc"),
  Value = c(300,200,100,50)
)



left_join(sheet, main,
          by = "Company")

stringdist_left_join(sheet,main,
                     by = "Company",
                     max_dist = 5)

If you still prefer to use Excel for Data Analysis - Check this out!

Related Posts:

To leave a comment for the author, please follow the link and comment on their blog: r-bloggers on Programming with R.

R-bloggers.com offers daily e-mail updates about R news and tutorials about learning R and many other topics. Click here if you're looking to post or find an R/data-science job.
Want to share your content on R-bloggers? click here if you have a blog, or here if you don't.

Never miss an update!
Subscribe to R-bloggers to receive
e-mails with the latest R posts.
(You will not see this message again.)

Click here to close (This popup will not appear again)