st_makeline.RdLines can be created from point aggregates (using summarise) or from -- to
to create a 2-vertex line.
st_makeline(.geom, .to, ...)
| .geom | A geometry or a set of geometries of class |
|---|---|
| .to | A point geometry to create pairwise lines. |
| ... | Unused. |
A line (LINESTRING) of class sfc.
Other make: st_makepoint,
st_multi, st_numpoints
library(dplyr)#> #>#> #> #>#> #> #>library(tibble) x <- tibble(g = c("a", "a"), point = c(st_point(12, 21), st_point(21, 12))) x %>% summarise(line = st_makeline(point))#> # A tibble: 1 x 1 #> line #> <LINESTRING> #> 1 (12 21, 21 12)