我在数据框中具有以下坐标
origin_lon origin_lat dest_lon dest_lat
<dbl> <dbl> <dbl> <dbl>
-84.42778 33.63667 -87.90667 41.9744
我想通过将通过将那些坐标连接成相等数量的零件(定义)而形成的线段划分来创建新的数据框。
longitude latitude
-84.42778 33.63667
... ...
-87.90667 41.9744
我正在尝试使用以下方法实现此目的
tibble(longitude=-84.42778:-87.90667, latitude=33.63667:41.9744)
但不确定这是否正确。
数据
df <- structure(list(origin_lon = -84.42778, origin_lat = 33.63667,
dest_lon = -87.90667, dest_lat = 41.9744), class = "data.frame",
row.names = c(NA, -1L))