R Under development (unstable) (2024-09-06 r87101 ucrt) -- "Unsuffered Consequences" Copyright (C) 2024 The R Foundation for Statistical Computing Platform: x86_64-w64-mingw32/x64 R is free software and comes with ABSOLUTELY NO WARRANTY. You are welcome to redistribute it under certain conditions. Type 'license()' or 'licence()' for distribution details. R is a collaborative project with many contributors. Type 'contributors()' for more information and 'citation()' on how to cite R or R packages in publications. Type 'demo()' for some demos, 'help()' for on-line help, or 'help.start()' for an HTML browser interface to help. Type 'q()' to quit R. > suppressPackageStartupMessages(library(sf)) > c(st_point(1:2), st_point(5:6)) MULTIPOINT ((1 2), (5 6)) > c(st_point(1:2), st_multipoint(matrix(5:8,2))) MULTIPOINT ((1 2), (5 7), (6 8)) > c(st_multipoint(matrix(1:4,2)), st_multipoint(matrix(5:8,2))) MULTIPOINT ((1 3), (2 4), (5 7), (6 8)) > c(st_linestring(matrix(1:6,3)), st_linestring(matrix(11:16,3))) MULTILINESTRING ((1 4, 2 5, 3 6), (11 14, 12 15, 13 16)) > c(st_linestring(matrix(1:6,3)), st_multilinestring(list(matrix(11:16,3)))) MULTILINESTRING ((11 14, 12 15, 13 16), (1 4, 2 5, 3 6)) > c(st_multilinestring(list(matrix(1:6,3))), st_multilinestring(list(matrix(11:16,3)))) MULTILINESTRING ((1 4, 2 5, 3 6), (11 14, 12 15, 13 16)) > pl = list(rbind(c(0,0), c(1,0), c(1,1), c(0,1), c(0,0))) > c(st_polygon(pl), st_polygon(pl)) MULTIPOLYGON (((0 0, 1 0, 1 1, 0 1, 0 0)), ((0 0, 1 0, 1 1, 0 1, 0 0))) > c(st_polygon(pl), st_multipolygon(list(pl))) MULTIPOLYGON (((0 0, 1 0, 1 1, 0 1, 0 0)), ((0 0, 1 0, 1 1, 0 1, 0 0))) > c(st_linestring(matrix(1:6,3)), st_point(1:2)) GEOMETRYCOLLECTION (LINESTRING (1 4, 2 5, 3 6), POINT (1 2)) > c(st_geometrycollection(list(st_point(1:2), st_linestring(matrix(1:6,3)))), + st_geometrycollection(list(st_multilinestring(list(matrix(11:16,3)))))) GEOMETRYCOLLECTION (POINT (1 2), LINESTRING (1 4, 2 5, 3 6), MULTILINESTRING ((11 14, 12 15, 13 16))) > c(st_geometrycollection(list(st_point(1:2), st_linestring(matrix(1:6,3)))), + st_multilinestring(list(matrix(11:16,3))), st_point(5:6), + st_geometrycollection(list(st_point(10:11)))) GEOMETRYCOLLECTION (MULTILINESTRING ((11 14, 12 15, 13 16)), POINT (5 6), POINT (1 2), LINESTRING (1 4, 2 5, 3 6), POINT (10 11)) > head(st_point(0:1), 2) POINT (0 1) > > # Ops.sfg: > ls = st_linestring(rbind(c(0,0),c(0,1))) > pt = st_point(1:0) > ls | pt GEOMETRYCOLLECTION (LINESTRING (0 0, 0 1), POINT (1 0)) > ls / pt LINESTRING (0 0, 0 1) > ls & pt GEOMETRYCOLLECTION EMPTY > ls %/% pt GEOMETRYCOLLECTION (LINESTRING (0 0, 0 1), POINT (1 0)) > # arith: > ls + pt LINESTRING (1 0, 1 1) > ls - pt LINESTRING (-1 0, -1 1) > ls * pt LINESTRING (0 0, 0 0) > ls / pt LINESTRING (0 0, 0 1) > # unary: > +pt POINT (1 0) > -pt POINT (-1 0) > try(!pt) Error in Ops.sfg(pt) : unary ! not defined for "sfg" objects > > proc.time() user system elapsed 0.48 0.04 0.51