x <- matrix( c(1:4), ncol = 2 )
sfc_linestring( x )
x <- data.frame( id = 1:2, x = 1:2, y = 2:1 )
sfc_linestring( x )
sfc_linestring( x, x = "x", y = "y" )
sfc_linestring( x, x = "y", y = "x" )
sfc_linestring( x, linestring_id = "id", x = "x", y = "y")
df <- data.frame(
id = c(1,1,1,1,2,2,2)
, x = 1:7
, y = 7:1
, z = 14:8
, m = 8:14
)
sfc_linestring(df, x = "x", y = "y", linestring_id = "id")
sfc_linestring(df, x = "x", y = "y", z = "z", linestring_id = "id")
sfc_linestring(df, x = "x", y = "y", m = "m", linestring_id = "id")
sfc_linestring(df, x = "x", y = "y", z = "z", m = "m", linestring_id = "id")
Run the code above in your browser using DataLab