This function returns the coordinates for all unique origins and/or destinations in supplied data.

get_unique_coords(data, orig = TRUE, dest = TRUE)

Arguments

data

generalized data frame described in travel_data_template or derivative thereof

orig

logical indicating whether to include unique coordinates from origin locations (default=TRUE)

dest

logical indicating whether to include unique coordinates from destination locations (default=TRUE)

Value

three column dataframe containing unique coordinates and location names

See also

Author

John Giles

Examples

x <- cbind(travel_data_sim, get_unique_ids(travel_data_sim, adm_start=1)) # Unique coordinates for all locations get_unique_coords(x)
#> x y id #> 1 -88.29221 30.83746 B_A #> 2 -89.69678 29.24754 B_B #> 3 -89.13090 29.77110 B_C #> 4 -92.66871 30.16262 B_D #> 5 -89.21258 29.99380 B_E #> 6 -89.02880 29.24454 B_F #> 7 -90.48338 30.20637 B_G #> 8 -92.14014 30.30028 B_H #> 9 -91.04174 29.09913 B_I #> 10 -90.93640 29.51108 B_J #> 11 -91.86877 30.61928 B_K #> 12 -89.63264 31.11749 B_L #> 13 -87.64756 30.19300 B_M #> 14 -92.44102 29.84759 B_N #> 15 -91.54358 30.41202 B_O #> 16 -87.53205 29.53644 B_Q #> 17 -90.32786 29.26497 B_R #> 18 -89.42690 30.79359 B_S #> 19 -89.19274 29.31429 B_T #> 20 -89.17927 29.75802 B_U #> 21 -87.51416 28.57231 B_V #> 22 -88.94629 30.62857 B_W #> 23 -89.94231 29.22100 B_Y #> 24 -90.86426 29.62520 B_Z
# Origins only get_unique_coords(x, dest=FALSE)
#> x y id #> 1 -89.13090 29.77110 B_C #> 2 -92.66871 30.16262 B_D #> 3 -89.21258 29.99380 B_E #> 4 -90.48338 30.20637 B_G #> 5 -92.14014 30.30028 B_H #> 6 -91.04174 29.09913 B_I #> 7 -90.93640 29.51108 B_J #> 8 -91.86877 30.61928 B_K #> 9 -92.44102 29.84759 B_N #> 10 -91.54358 30.41202 B_O #> 11 -87.53205 29.53644 B_Q #> 12 -90.32786 29.26497 B_R #> 13 -89.42690 30.79359 B_S #> 14 -89.19274 29.31429 B_T #> 15 -87.51416 28.57231 B_V #> 16 -89.94231 29.22100 B_Y #> 17 -90.86426 29.62520 B_Z
# Destinations only get_unique_coords(x, orig=FALSE)
#> x y id #> 1 -88.29221 30.83746 B_A #> 2 -89.69678 29.24754 B_B #> 3 -89.13090 29.77110 B_C #> 4 -92.66871 30.16262 B_D #> 5 -87.24678 30.44069 B_E #> 6 -89.02880 29.24454 B_F #> 7 -90.16798 30.79019 B_G #> 8 -90.36079 28.72255 B_H #> 9 -91.89124 30.00705 B_I #> 10 -89.09594 29.02270 B_J #> 11 -91.86877 30.61928 B_K #> 12 -89.63264 31.11749 B_L #> 13 -87.64756 30.19300 B_M #> 14 -92.44102 29.84759 B_N #> 15 -86.44252 31.18493 B_O #> 16 -87.53205 29.53644 B_Q #> 17 -88.07638 28.73870 B_R #> 18 -89.42690 30.79359 B_S #> 19 -89.19274 29.31429 B_T #> 20 -89.17927 29.75802 B_U #> 21 -87.51416 28.57231 B_V #> 22 -88.94629 30.62857 B_W #> 23 -90.53148 29.73601 B_Y #> 24 -90.86426 29.62520 B_Z
# Without supplied ids get_unique_coords(travel_data_sim)
#> Added missing unique location names.
#> x y id #> 1 -88.29221 30.83746 A_B_A #> 2 -89.69678 29.24754 A_B_B #> 3 -89.13090 29.77110 A_B_C #> 4 -92.66871 30.16262 A_B_D #> 5 -89.21258 29.99380 A_B_E #> 6 -89.02880 29.24454 A_B_F #> 7 -90.48338 30.20637 A_B_G #> 8 -92.14014 30.30028 A_B_H #> 9 -91.04174 29.09913 A_B_I #> 10 -90.93640 29.51108 A_B_J #> 11 -91.86877 30.61928 A_B_K #> 12 -89.63264 31.11749 A_B_L #> 13 -87.64756 30.19300 A_B_M #> 14 -92.44102 29.84759 A_B_N #> 15 -91.54358 30.41202 A_B_O #> 16 -87.53205 29.53644 A_B_Q #> 17 -90.32786 29.26497 A_B_R #> 18 -89.42690 30.79359 A_B_S #> 19 -89.19274 29.31429 A_B_T #> 20 -89.17927 29.75802 A_B_U #> 21 -87.51416 28.57231 A_B_V #> 22 -88.94629 30.62857 A_B_W #> 23 -89.94231 29.22100 A_B_Y #> 24 -90.86426 29.62520 A_B_Z