1) Get route between two points.
library(ggmap)
# output = 'all' so we get the polyline of the path along the road
my_route <- route(from = "29.98671,31.21431",
to = "29.97864,31.17557",
structure = "route",
output = "all")
my_polyline <- my_route$routes[[1]]$legs[[1]]$steps[[1]]$polyline$points
2) Decode polyline to series of points, using function from this linked question
How to decode encoded polylines from OSRM and plotting route geometry?
# DecodeLineR <- function(encoded) {... see linked question ...}
route_points <- DecodeLineR(my_polyline)
3) Plot all the route points, along with our new point
new_point <- data.frame(lat=29.987201, lng=31.188547)
ggplot(route_points, aes(x=lng, y=lat)) +
geom_point(shape=21, alpha=0.5) +
geom_point(data = new_point, color = 'red') +
coord_quickmap() +
theme_linedraw()

4) Find which "route point" is closest to the new point
# get each distance in miles (great circle distance in miles)
library(fields)
route_points$distance_to_new <- t(rdist.earth(new_point, route_points))
# it's this one:
route_points[which.min(route_points$distance_to_new), ]
Answer: The 76th point on the poly line is closest, at ~0.19 miles away
lat lng distance_to_new
76 29.98688 31.18853 0.01903183