GeocodeIPs: GeocodeIP addresses

View source: R/GeocodeIPs.R

GeocodeIPsR Documentation

GeocodeIP addresses

Description

Returns the country and continent of a vector of IPv4 or IPv6 strings.

Usage

GeocodeIPs(ips)

Arguments

ips

Character vector of IP addresses.

Details

Uses the IP2Location LITE or IP2Location databases from IP2Location to resolve country locations from IP addresses. The database must be downloaded and the database path set as the environment variable IP2LOCATION_DB_PATH before use. The database can be downloaded from IP2Location LITE or IP2Location. To interact with the database a python environment is required that has the IP2Location python package installed. If an invalid IP address or the information is not available in the database, the country_name and country_code columns will be set to NA. The LITE database should achieve an accuracy at the country level of 98%. If you need more accuracy, you can use the commercial license with the IP2Location database. More details on the differences between the databases can be found at IP2Location comparisons.

Value

A data.frame with columns

  • ips - the original input ips

  • continent_name - the name of the continent where the IP is located

  • country_name - the name of the country where the IP is located

  • country_code - the 2 letter country code (ISO Alpha-2)

Examples

## Not run: 
GeocodeIPs(c("123.51.111.134", "216.27.61.137", "2001:780:53d2::1"))

## End(Not run)

Displayr/flipAPI documentation built on June 2, 2025, 11:48 a.m.