Skip to content

Instantly share code, notes, and snippets.

@abdalimran
Created October 21, 2016 06:58
Show Gist options
  • Save abdalimran/087766b72d76fa2de6f1042e8352590c to your computer and use it in GitHub Desktop.
Save abdalimran/087766b72d76fa2de6f1042e8352590c to your computer and use it in GitHub Desktop.
library(rgeolocate)
setwd("/home/imran/Documents/")
ipdf <- read.csv("IP_Address.csv")
ipmmdb <- system.file("extdata","GeoLite2-Country.mmdb", package = "rgeolocate")
results <- maxmind(ipdf$IP.Address, ipmmdb,"country_name")
export.results <- data.frame(ipdf$IP.Address, results$country_name)
colnames(export.results) <- c("IP Address", "Country")
write.csv(export.results, "IP_to_Locationmmdb.csv")
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment