# How to generate distance variable using street addresses [closed]

I have data of sold apartments. There is a street address for every apartment and I would like to generate a new variable that tells the distance from the train station. There are over thousand units in the data so I need figure out a efficient way to calculate the distance for each unit.

Sample of data:

Helsinki, Melkonkatu 21
Helsinki, Vaasankatu 7
Helsinki, Siilitie 6
Helsinki, Muukalaiskatu 2

And the address for train station is "Helsinki, Kaivokatu 1"

• This is programming question rather than an statistics one, but Google Maps and other routing services can do this and they can be automated. Example: stackoverflow.com/questions/36775672/… – Pere Aug 14 '17 at 9:56
• Without a sample of your data it is really hard to give you any solid advice. Additionally, your question might be off-topic here as it seems you are asking how to calculate a distance based on certain fixed data. If I misunderstand however, and there is some estimation or the like required, it might be a 'statistics' question. Please elaborate. – IWS Aug 14 '17 at 9:56
• My goal is to create statistical model for aparment pricing and the distance from train station would be one of the predictors. – ZeiH Aug 14 '17 at 10:21

From here most pieces of software will have a library for calculating distances from lat/long coordinates for example in R you can use the geosphere package.