I have a data frame that contains the longitude/latitude of various patients' city locations. I am curious about each patient's distance traveled to the hospital. Is there a way I can somehow find out the distance each patient traveled to the hospital with the geodist
package?
Lets say the hospital is located here:
Latitude: 36.840
Longitude: -119.850
I want to calculate the distance between the hospital and where each patient lives. Here is my dataset:
> dput(d)
structure(list(major_city = c("Mountain View", "Watsonville",
"Honolulu", "Los Altos", "Morgan Hill", "Fulton", "Oak Grove",
"Port Kent", "Bedford", "San Jose"), latitude = c(37.39, 36.9,
21.31, 37.36, 37.1, 43.3, 36.69, 44.526, NA, 37.27), longitude = c(-122.07,
-121.7, -157.85, -122.15, -121.7, -76.4, -87.44, -73.409, NA,
-121.84)), row.names = c(NA, -10L), class = c("data.table", "data.frame"
), .internal.selfref = <pointer: 0x7f98af80bae0>, index = integer(0))
I want to do this for the entire dataset rather than just one patient.