I have a large set of data with Longitudes and Latitudes that I want to convert into UK Postcodes. I first tried downloading all of the UK postcodes with their corresponding long/lat and then joining the data together. This worked for some of the data but the majority didn't match due to postcode latitude and longitude being the centre of each postcode, where as my data is more accurate.

I've also tried a bit of code that converts Lat/long in America to give the corresponding state (given by Josh O'Brien here [Latitude Longitude Coordinates to State Code in R](https://stackoverflow.com/questions/8751497/latitude-longitude-coordinates-to-state-code-in-r)), but I couldn't find a way to alter this to UK postcodes.

I've also tried running a calculation that tries to find the closest postcode to the long/lat but this create a file too large for R to handle. 

Also seen some code that uses google maps (geocoding) and this does seem to work but I've read it only allows 2000 calculations a day, I have much more than this (around 5 million rows of data)