I recently posted a question regarding plotting postions on cities in europe as points on a map. See R, get longitude/latitude data for cities and add it to my dataframe
You can use below code to extract information from Bing Map API
for(i in 1:length(PinCode)){
var = PinCode[i]
link=paste("http://dev.virtualearth.net/REST/v1/Locations?postalCode=", var, "&o=xml&maxResults=1&key=[YOurKey]",sep = "")
data<- xmlParse(link)
xml_data <- xmlToList(data)
PinCodeLatLongtemp <- data.frame(PinCode = "Temp", Lat = "Lat", Long = "Long")
PinCodeLatLongtemp$PinCode <- var
PinCodeLatLongtemp$Lat <-
xml_data$ResourceSets$ResourceSet$Resources$Location$Point$Latitude
PinCodeLatLongtemp$Long <-
xml_data$ResourceSets$ResourceSet$Resources$Location$Point$Longitude
PinCodeLatLong <- rbindlist(list(PinCodeLatLongtemp,PinCodeLatLong), fill = T)
}
It will create a new dataframe with you input 'Pincode' and Two new columns with Lat and Long. YOu can get your key from [here] (https://www.bingmapsportal.com)