geolocate: Geolocate an IP address (v4 o4 v6) or domain name via <URL:...

Description Usage Arguments Details Value Examples

Description

Given a character vector of IP addresses (v4 or v6) and/or domain names, this function will return a data.table of geolocated values with the columns mapped to the ip-api.com's successful response fields (see: http://ip-api.com/docs/api:returned_values for more info).

Usage

1
geolocate(entities, .progress = TRUE)

Arguments

.progress

show a progress bar? (useful if geolocating many entities)

entites

character vector of items to geolocate

Details

A small delay is introducted to each geolocation call to help avoid having your IP address being banned by the ip-api.com servers.

If there is an error in the http transaction, a warning will be generated and the lookup response will be populated with NAs. Similarly, if there is a geocoding failure, the response for that query will also be populated with NAs

Value

data.table of responses

Examples

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
## Not run: 
resp <- geolocate(c(NA, "10.0.1.1", "", "72.33.67.89", "dds.ec", " ",
                        "search.twitter.com"))
resp[,c(9,4,7,8),with=F]
           query countryCode       lon                             org
## 1: 50.252.233.22          US  -69.9739                   Comcast Cable
## 2:      10.0.1.1          NA        NA                              NA
## 3: 50.252.233.22          US  -69.9739                   Comcast Cable
## 4:   72.33.67.89          US  -89.4012 University of Wisconsin Madison
## 5: 162.243.111.4          US  -73.9865                   Digital Ocean
## 6: 50.252.233.22          US  -69.9739                   Comcast Cable
## 7: 199.59.148.11          US -122.3933                         Twitter

## End(Not run)

hrbrmstr/ipapi documentation built on May 17, 2019, 5:09 p.m.