R: Convert Brightkite location ID to place name

I've downloaded BrightKite data from SNAP for data mining purposes using R programming, each record of the dataset is in the form:

user    time                 lat           long                 locID
0   2010-10-17T01:48:53Z    39.747652   -104.99251 88c46bf20db295831bd2d1718ad7e6f5

My problem is that I want to know what place each location Id is corresponding to, isn't there any method by which I can parse Location IDs into places names?


The geonames API can get this. Install the latest version from github using devtools (install devtools from CRAN first if you haven't got it yet) and get yourself a geonames username from http://www.geonames.org/ :

> devtools::install_github("ropensci/geonames")
> require(geonames)
> options(geonamesUsername="sarashaker") # create a user at geonames.org

Then for some place with lat/long:

> place
       lat      long
1 39.74765 -104.9925

Call to GNfindNearby with a small radius parameter:

> res = GNfindNearby(lat=place$lat, lng=place$long,radius=0.1)
Warning message:
In GNfindNearby(lat = place$lat, lng = place$long, radius = 0.1) :
  Not documented properly yet by geonames

Ignore the warning - I don't think the response was well documented when I wrote this package. Anyway, the nearest match is the first element of the first element:

> closest = res[[1]][[1]]
> closest$name
[1] "Residence Inn by Marriott Denver City Center"
> closest$distance
[1] "0.01083"

The next closest place is the second element of the first element:

> res[[1]][[2]]$name
[1] "Hotel Monaco Denver - a Kimpton Hotel"
> res[[1]][[2]]$dist
[1] "0.01933"