How can i convert lattitude and longitude into km?

Hi! Welcome!

Have a look at the geosphere package. It has the function distHaversine. Is that what you are looking for?

JW