# Bike from the NYC to Google!
address <- c("350 5th Ave, New York, NY 10118, USA",
			 "1600 Amphitheatre Pkwy, Mountain View, CA 94043, USA")
coordset <- geocode_url(address, auth="standard_api", privkey="",
            clean=TRUE, add_date='today', verbose=TRUE)
# Save coordinates. Google requires a format of: "lat,lng" (with no spaces)
start <- paste(coordset$lat[1],coordset$lng[1], sep=",")
end <- paste(coordset$lat[2],coordset$lng[2], sep=",")
# Get the travel time by bike (a mere 264 hours!) and distance in miles:
howfar_miles <- drive_time(address=start, dest=end, auth="standard_api",
						   privkey="", clean=FALSE, add_date='today',
						   verbose=FALSE, travel_mode="bicycling",
						   units="imperial")
# Get the distance in kilometers using physical addresses instead of lat/lng:
howfar_kms <- drive_time(
     address="350 5th Ave, New York, NY 10118, USA",
		dest="1600 Amphitheatre Pkwy, Mountain View, CA 94043",
		auth="standard_api", privkey="", clean=FALSE,
		add_date='today', verbose=FALSE, travel_mode="bicycling",
		units="imperial"
		)
with(howfar_kms, cat("Cycling from NYC to ", destination,
					 ":\n", dist_txt, "\n", time_txt, sep=""))
Run the code above in your browser using DataLab