Running ‘aggregate.R’ [1s/1s]
  Comparing ‘aggregate.Rout’ to ‘aggregate.Rout.save’ ...4c4
< Linking to GEOS 3.6.2, GDAL 2.3.0, proj.4 5.0.1
---
> Linking to GEOS 3.6.2, GDAL 2.2.3, proj.4 4.9.3
  Running ‘cast.R’ [1s/1s]
  Comparing ‘cast.Rout’ to ‘cast.Rout.save’ ... OK
  Running ‘crs.R’ [1s/1s]
  Comparing ‘crs.Rout’ to ‘crs.Rout.save’ ... OK
  Running ‘dist.R’ [2s/2s]
  Comparing ‘dist.Rout’ to ‘dist.Rout.save’ ... OK
  Running ‘dplyr.R’ [6s/6s]
  Comparing ‘dplyr.Rout’ to ‘dplyr.Rout.save’ ...188,189c188,189
<   <S3: units>                                                <MULTIPOLYGON [m]>
< 1 2.58936155283424e-06 (((834893.7 95747.49, 833834.2 98254.6, 835420.2 98655.…
---
>            <[person/m^2]>                                    <MULTIPOLYGON [m]>
> 1 2.589362e-06 person/m^2 (((834893.7 95747.49, 833834.2 98254.6, 835420.2 986…
210,211c210,211
<   <S3: units>                                                <MULTIPOLYGON [m]>
< 1 329962              (((834893.7 95747.49, 833834.2 98254.6, 835420.2 98655.7…
---
>            <[person]>                                        <MULTIPOLYGON [m]>
> 1       329962 person (((834893.7 95747.49, 833834.2 98254.6, 835420.2 98655.7…
  Running ‘empty.R’ [1s/1s]
  Comparing ‘empty.Rout’ to ‘empty.Rout.save’ ... OK
  Running ‘gdal_geom.R’ [2s/2s]
  Comparing ‘gdal_geom.Rout’ to ‘gdal_geom.Rout.save’ ...106c106
< GDAL has 85 drivers
---
> GDAL has 80 drivers
  Running ‘geos.R’ [9s/9s]
  Comparing ‘geos.Rout’ to ‘geos.Rout.save’ ... OK
  Running ‘graticule.R’ [4s/4s]
  Comparing ‘graticule.Rout’ to ‘graticule.Rout.save’ ... OK
  Running ‘grid.R’ [2s/2s]
  Comparing ‘grid.Rout’ to ‘grid.Rout.save’ ... OK
  Running ‘plot.R’ [9s/9s]
  Comparing ‘plot.Rout’ to ‘plot.Rout.save’ ... OK
  Running ‘read.R’ [3s/3s]
  Comparing ‘read.Rout’ to ‘read.Rout.save’ ...141c141
< Error in guess_driver(dns) : length(dsn) == 1 is not TRUE
---
> Error : length(dsn) == 1 is not TRUE
334c334
< Reading layer `Parcely' from data source `/home/hornik/tmp/R.check/r-devel-clang/Work/build/Packages/sf/gml/20170930_OB_530964_UKSH.xml.gz' using driver `GML'
---
> Reading layer `Parcely' from data source `/home/edzer/git/sf.Rcheck/sf/gml/20170930_OB_530964_UKSH.xml.gz' using driver `GML'
352c352
< Reading layer `Parcely' from data source `/home/hornik/tmp/R.check/r-devel-clang/Work/build/Packages/sf/gml/20170930_OB_530964_UKSH.xml.gz' using driver `GML'
---
> Reading layer `Parcely' from data source `/home/edzer/git/sf.Rcheck/sf/gml/20170930_OB_530964_UKSH.xml.gz' using driver `GML'
384c384
< Reading layer `tst__' from data source `/home/hornik/tmp/R.check/r-devel-clang/Work/PKGS/sf.Rcheck/tests/tst__.gpkg' using driver `GPKG'
---
> Reading layer `tst__' from data source `/home/edzer/git/sf.Rcheck/tests/tst__.gpkg' using driver `GPKG'
  Running ‘roundtrip.R’ [9s/9s]
  Comparing ‘roundtrip.Rout’ to ‘roundtrip.Rout.save’ ...43a44,46
> Warning message:
> In data.row.names(row.names, rowsi, i) :
>   some row.names duplicated: 2,3,5,6,7,8,10,11,12,13,14,15 --> row.names NOT used
  Running ‘sfc.R’ [5s/5s]
Running the tests in ‘tests/sfc.R’ failed.
Complete output:
  > suppressPackageStartupMessages(library(sf))
  > library(testthat)
  > 
  > p = st_point(c(1/3,1/6))
  > st_sfc(p, precision = 1000)
  Geometry set for 1 feature 
  geometry type:  POINT
  dimension:      XY
  bbox:           xmin: 0.3333333 ymin: 0.1666667 xmax: 0.3333333 ymax: 0.1666667
  epsg (SRID):    NA
  proj4string:    NA
  precision:      1000 
  POINT (0.3333333 0.1666667)
  > st_as_sfc(st_as_binary(st_sfc(p, precision = 0L)))
  Geometry set for 1 feature 
  geometry type:  POINT
  dimension:      XY
  bbox:           xmin: 0.3333333 ymin: 0.1666667 xmax: 0.3333333 ymax: 0.1666667
  epsg (SRID):    NA
  proj4string:    NA
  POINT (0.3333333 0.1666667)
  > st_as_sfc(st_as_binary(st_sfc(p, precision = 1000)))
  Geometry set for 1 feature 
  geometry type:  POINT
  dimension:      XY
  bbox:           xmin: 0.333 ymin: 0.167 xmax: 0.333 ymax: 0.167
  epsg (SRID):    NA
  proj4string:    NA
  POINT (0.333 0.167)
  > st_as_sfc(st_as_binary(st_sfc(p, precision = 1000000)))
  Geometry set for 1 feature 
  geometry type:  POINT
  dimension:      XY
  bbox:           xmin: 0.333333 ymin: 0.166667 xmax: 0.333333 ymax: 0.166667
  epsg (SRID):    NA
  proj4string:    NA
  POINT (0.333333 0.166667)
  > st_as_sfc(st_as_binary(st_sfc(p, precision = 10L)))
  Geometry set for 1 feature 
  geometry type:  POINT
  dimension:      XY
  bbox:           xmin: 0.3 ymin: 0.2 xmax: 0.3 ymax: 0.2
  epsg (SRID):    NA
  proj4string:    NA
  POINT (0.3 0.2)
  > st_as_sfc(st_as_binary(st_sfc(p, precision = -1)))
  Geometry set for 1 feature 
  geometry type:  POINT
  dimension:      XY
  bbox:           xmin: 0.3333333 ymin: 0.1666667 xmax: 0.3333333 ymax: 0.1666667
  epsg (SRID):    NA
  proj4string:    NA
  POINT (0.3333333 0.1666667)
  > 
  > d = data.frame(a = 1:2)
  > d$geom = c("POINT(0 0)", "POINT(1 1)")
  > 
  > st_as_sf(d, wkt = "geom")
  Simple feature collection with 2 features and 1 field
  geometry type:  POINT
  dimension:      XY
  bbox:           xmin: 0 ymin: 0 xmax: 1 ymax: 1
  epsg (SRID):    NA
  proj4string:    NA
    a        geom
  1 1 POINT (0 0)
  2 2 POINT (1 1)
  > st_as_sf(d, wkt = 2)
  Simple feature collection with 2 features and 1 field
  geometry type:  POINT
  dimension:      XY
  bbox:           xmin: 0 ymin: 0 xmax: 1 ymax: 1
  epsg (SRID):    NA
  proj4string:    NA
    a        geom
  1 1 POINT (0 0)
  2 2 POINT (1 1)
  > st_as_sf(d, wkt = "geom", remove = FALSE)
  Simple feature collection with 2 features and 2 fields
  geometry type:  POINT
  dimension:      XY
  bbox:           xmin: 0 ymin: 0 xmax: 1 ymax: 1
  epsg (SRID):    NA
  proj4string:    NA
    a       geom    geometry
  1 1 POINT(0 0) POINT (0 0)
  2 2 POINT(1 1) POINT (1 1)
  > 
  > st_as_sfc(c("POINT(0 0)", "POINT(1 1)"))
  Geometry set for 2 features 
  geometry type:  POINT
  dimension:      XY
  bbox:           xmin: 0 ymin: 0 xmax: 1 ymax: 1
  epsg (SRID):    NA
  proj4string:    NA
  POINT (0 0)
  POINT (1 1)
  > st_as_sfc(c("POINT(0 0)", "POINT(1 1)", "POLYGON((0 0,1 1,0 1,0 0))"))
  Geometry set for 3 features 
  geometry type:  GEOMETRY
  dimension:      XY
  bbox:           xmin: 0 ymin: 0 xmax: 1 ymax: 1
  epsg (SRID):    NA
  proj4string:    NA
  POINT (0 0)
  POINT (1 1)
  POLYGON ((0 0, 1 1, 0 1, 0 0))
  > st_as_sfc(character(0))
  Geometry set for 0 features 
  bbox:           xmin: NA ymin: NA xmax: NA ymax: NA
  epsg (SRID):    NA
  proj4string:    NA
  > st_as_sfc(character(0), 4326)
  Geometry set for 0 features 
  bbox:           xmin: NA ymin: NA xmax: NA ymax: NA
  epsg (SRID):    4326
  proj4string:    +proj=longlat +datum=WGS84 +no_defs
  > st_as_sfc(c("POINT(0 0)", "POINT(1 1)", "POLYGON((0 0,1 1,0 1,0 0))"), 
  + 	"+proj=longlat +datum=WGS84")
  Geometry set for 3 features 
  geometry type:  GEOMETRY
  dimension:      XY
  bbox:           xmin: 0 ymin: 0 xmax: 1 ymax: 1
  epsg (SRID):    4326
  proj4string:    +proj=longlat +datum=WGS84 +no_defs
  POINT (0 0)
  POINT (1 1)
  POLYGON ((0 0, 1 1, 0 1, 0 0))
  > dg = st_as_sf(d, wkt = "geom")
  > print(dg, n = 1)
  Simple feature collection with 2 features and 1 field
  geometry type:  POINT
  dimension:      XY
  bbox:           xmin: 0 ymin: 0 xmax: 1 ymax: 1
  epsg (SRID):    NA
  proj4string:    NA
  First 1 features:
    a        geom
  1 1 POINT (0 0)
  > head(st_as_sf(d, wkt = "geom"), 1)
  Simple feature collection with 1 feature and 1 field
  geometry type:  POINT
  dimension:      XY
  bbox:           xmin: 0 ymin: 0 xmax: 0 ymax: 0
  epsg (SRID):    NA
  proj4string:    NA
    a        geom
  1 1 POINT (0 0)
  > 
  > d$geom = st_as_sfc(d$geom)
  > d1 = d
  > attr(d1, "sf_col") = "geom"
  > st_geometry(d1) = d$geom
  > 
  > d$geometry = d$geom # second geometry list-column
  > expect_warning(st_geometry(d) <- d$geom)
  > d
  Simple feature collection with 2 features and 1 field
  Active geometry column: geom
  geometry type:  POINT
  dimension:      XY
  bbox:           xmin: 0 ymin: 0 xmax: 1 ymax: 1
  epsg (SRID):    NA
  proj4string:    NA
    a        geom    geometry
  1 1 POINT (0 0) POINT (0 0)
  2 2 POINT (1 1) POINT (1 1)
  > 
  > x = st_sfc(list(st_point(0:1), st_point(0:1)), crs = 4326)
  > # don't warn when replacing crs with identical value:
  > st_sfc(x, crs = 4326)
  Geometry set for 2 features 
  geometry type:  POINT
  dimension:      XY
  bbox:           xmin: 0 ymin: 1 xmax: 0 ymax: 1
  epsg (SRID):    4326
  proj4string:    +proj=longlat +datum=WGS84 +no_defs
  POINT (0 1)
  POINT (0 1)
  > st_sfc(x, crs = "+proj=longlat +datum=WGS84 +no_defs")
  Geometry set for 2 features 
  geometry type:  POINT
  dimension:      XY
  bbox:           xmin: 0 ymin: 1 xmax: 0 ymax: 1
  epsg (SRID):    4326
  proj4string:    +proj=longlat +datum=WGS84 +no_defs
  POINT (0 1)
  POINT (0 1)
  > # but do when it changes:
  > st_sfc(x, crs = 3857)
  Geometry set for 2 features 
  geometry type:  POINT
  dimension:      XY
  bbox:           xmin: 0 ymin: 1 xmax: 0 ymax: 1
  epsg (SRID):    3857
  proj4string:    +proj=merc +a=6378137 +b=6378137 +lat_ts=0.0 +lon_0=0.0 +x_0=0.0 +y_0=0 +k=1.0 +units=m +nadgrids=@null +wktext +no_defs
  POINT (0 1)
  POINT (0 1)
  Warning message:
  st_crs<- : replacing crs does not reproject data; use st_transform for that 
  > 
  > p = st_point(0:1)
  > st_cast(p, "MULTIPOINT")
  MULTIPOINT (0 1)
  > mp = st_multipoint(rbind(c(0,1), c(2,2)))
  > st_cast(mp, "POINT")
  POINT (0 1)
  Warning message:
  In st_cast.MULTIPOINT(mp, "POINT") : point from first coordinate only
  > st_cast(mp, "MULTIPOINT")
  MULTIPOINT (0 1, 2 2)
  > 
  > # geometry collection to its elements:
  > st_cast(st_geometrycollection(list(mp)), "POINT")
  POINT (0 1)
  Warning message:
  In st_cast.MULTIPOINT(x[[1]], to, ...) : point from first coordinate only
  > st_cast(st_geometrycollection(list(mp)), "MULTIPOINT")
  MULTIPOINT (0 1, 2 2)
  > st_cast(st_geometrycollection(list(p,mp)), "MULTIPOINT")
  MULTIPOINT (0 1)
  Warning message:
  In st_cast.GEOMETRYCOLLECTION(st_geometrycollection(list(p, mp)),  :
    only first part of geometrycollection is retained
  > 
  > mp = st_multipoint(rbind(c(0,1)))
  > x = st_sfc(p, mp)
  > st_cast(x, "POINT")
  Geometry set for 2 features 
  geometry type:  POINT
  dimension:      XY
  bbox:           xmin: 0 ymin: 1 xmax: 0 ymax: 1
  epsg (SRID):    NA
  proj4string:    NA
  POINT (0 1)
  POINT (0 1)
  Warning message:
  In st_cast.MULTIPOINT(X[[i]], ...) : point from first coordinate only
  > 
  > sf = st_sf(a = 3:2, geom = x)
  > st_cast(sf, "POINT")
  Simple feature collection with 2 features and 1 field
  geometry type:  POINT
  dimension:      XY
  bbox:           xmin: 0 ymin: 1 xmax: 0 ymax: 1
  epsg (SRID):    NA
  proj4string:    NA
    a    geometry
  1 3 POINT (0 1)
  2 2 POINT (0 1)
  Warning message:
  In st_cast.MULTIPOINT(X[[i]], ...) : point from first coordinate only
  > 
  > suppressPackageStartupMessages( library(dplyr) )
  > 
  > x %>% st_cast("POINT")
  Geometry set for 2 features 
  geometry type:  POINT
  dimension:      XY
  bbox:           xmin: 0 ymin: 1 xmax: 0 ymax: 1
  epsg (SRID):    NA
  proj4string:    NA
  POINT (0 1)
  POINT (0 1)
  Warning message:
  In st_cast.MULTIPOINT(X[[i]], ...) : point from first coordinate only
  > 
  > # points:
  > mp = st_multipoint(rbind(c(0,1))) # single-point multipoint
  > st_sfc(p,mp) %>% st_cast("POINT")
  Geometry set for 2 features 
  geometry type:  POINT
  dimension:      XY
  bbox:           xmin: 0 ymin: 1 xmax: 0 ymax: 1
  epsg (SRID):    NA
  proj4string:    NA
  POINT (0 1)
  POINT (0 1)
  Warning message:
  In st_cast.MULTIPOINT(X[[i]], ...) : point from first coordinate only
  > st_sfc(p,mp) %>% st_cast("MULTIPOINT")
  Geometry set for 2 features 
  geometry type:  MULTIPOINT
  dimension:      XY
  bbox:           xmin: 0 ymin: 1 xmax: 0 ymax: 1
  epsg (SRID):    NA
  proj4string:    NA
  MULTIPOINT (0 1)
  MULTIPOINT (0 1)
  > 
  > # lines:
  > pts = rbind(c(0,0), c(1,1), c(2,1))
  > st_sfc(st_linestring(pts), st_multilinestring(list(pts))) %>% st_cast("LINESTRING")
  Geometry set for 2 features 
  geometry type:  LINESTRING
  dimension:      XY
  bbox:           xmin: 0 ymin: 0 xmax: 2 ymax: 1
  epsg (SRID):    NA
  proj4string:    NA
  LINESTRING (0 0, 1 1, 2 1)
  LINESTRING (0 0, 1 1, 2 1)
  > st_sfc(st_linestring(pts), st_multilinestring(list(pts))) %>% st_cast("MULTILINESTRING")
  Geometry set for 2 features 
  geometry type:  MULTILINESTRING
  dimension:      XY
  bbox:           xmin: 0 ymin: 0 xmax: 2 ymax: 1
  epsg (SRID):    NA
  proj4string:    NA
  MULTILINESTRING ((0 0, 1 1, 2 1))
  MULTILINESTRING ((0 0, 1 1, 2 1))
  > 
  > # polygons:
  > pts = rbind(c(0,0), c(1,1), c(0,1), c(0,0))
  > st_sfc(st_polygon(list(pts)), st_multipolygon(list(list(pts)))) %>% st_cast("POLYGON")
  Geometry set for 2 features 
  geometry type:  POLYGON
  dimension:      XY
  bbox:           xmin: 0 ymin: 0 xmax: 1 ymax: 1
  epsg (SRID):    NA
  proj4string:    NA
  POLYGON ((0 0, 1 1, 0 1, 0 0))
  POLYGON ((0 0, 1 1, 0 1, 0 0))
  > st_sfc(st_polygon(list(pts)), st_multipolygon(list(list(pts)))) %>% st_cast("MULTIPOLYGON")
  Geometry set for 2 features 
  geometry type:  MULTIPOLYGON
  dimension:      XY
  bbox:           xmin: 0 ymin: 0 xmax: 1 ymax: 1
  epsg (SRID):    NA
  proj4string:    NA
  MULTIPOLYGON (((0 0, 1 1, 0 1, 0 0)))
  MULTIPOLYGON (((0 0, 1 1, 0 1, 0 0)))
  > 
  > 
  > st_sfc(st_geometrycollection(list(p)), st_geometrycollection(list(mp))) %>% st_cast() 
  Geometry set for 2 features 
  geometry type:  GEOMETRY
  dimension:      XY
  bbox:           xmin: 0 ymin: 1 xmax: 0 ymax: 1
  epsg (SRID):    NA
  proj4string:    NA
  POINT (0 1)
  MULTIPOINT (0 1)
  > st_sfc(st_geometrycollection(list(p)), st_geometrycollection(list(mp))) %>% 
  + 	st_cast() %>% 
  + 	st_cast("POINT")
  Geometry set for 2 features 
  geometry type:  POINT
  dimension:      XY
  bbox:           xmin: 0 ymin: 1 xmax: 0 ymax: 1
  epsg (SRID):    NA
  proj4string:    NA
  POINT (0 1)
  POINT (0 1)
  Warning message:
  In st_cast.MULTIPOINT(X[[i]], ...) : point from first coordinate only
  > 
  > p = rbind(c(0,0),c(1,0),c(1,1),c(0,1),c(0,0))
  > pol = st_polygon(list(p))
  > # plot(pol)
  > try(plot(st_polygonize(pol))) # --> breaks
  Error in st_polygonize.sfc(st_sfc(x)) : 
    inherits(x, "sfc_LINESTRING") || inherits(x, "sfc_MULTILINESTRING") is not TRUE
  > st_length(st_sfc(st_point(c(0,0))))
  [1] 0
  > 
  > try(as(st_sfc(st_linestring(matrix(1:9,3))), "Spatial"))
  Error in StopZ(zm) : 
    sp supports Z dimension only for POINT and MULTIPOINT.
  use `drop_zm(...)` to coerce to XY dimensions
  > 
  > # check conus is present:
  > x = st_sfc(st_point(c(-90,35)), st_point(c(-80,36)), 
  + 	crs = "+proj=longlat +datum=NAD27")
  > st_transform(x, 3857)
  Geometry set for 2 features 
  geometry type:  POINT
  dimension:      XY
  bbox:           xmin: -10018760 ymin: 4163894 xmax: -8905533 ymax: 4300640
  epsg (SRID):    3857
  proj4string:    +proj=merc +a=6378137 +b=6378137 +lat_ts=0.0 +lon_0=0.0 +x_0=0.0 +y_0=0 +k=1.0 +units=m +nadgrids=@null +wktext +no_defs
  POINT (-10018764 4163894)
  POINT (-8905533 4300640)
  > 
  > sf_extSoftVersion()[1:3]
     GEOS    GDAL  proj.4 
  "3.6.2" "2.3.0" "5.0.1" 
  > 
  > # Ops.sfc:
  > ls = st_sfc(st_linestring(rbind(c(0,0),c(0,1))))
  > ls * 2
  Geometry set for 1 feature 
  geometry type:  LINESTRING
  dimension:      XY
  bbox:           xmin: 0 ymin: 0 xmax: 0 ymax: 2
  epsg (SRID):    NA
  proj4string:    NA
  LINESTRING (0 0, 0 2)
  > ls - 2
  Geometry set for 1 feature 
  geometry type:  LINESTRING
  dimension:      XY
  bbox:           xmin: -2 ymin: -2 xmax: -2 ymax: -1
  epsg (SRID):    NA
  proj4string:    NA
  LINESTRING (-2 -2, -2 -1)
  > (ls + 2) %% 3
  Geometry set for 1 feature 
  geometry type:  LINESTRING
  dimension:      XY
  bbox:           xmin: 2 ymin: 0 xmax: 2 ymax: 2
  epsg (SRID):    NA
  proj4string:    NA
  LINESTRING (2 2, 2 0)
  > ls / ls
  Geometry set for 1 feature  (with 1 geometry empty)
  geometry type:  GEOMETRYCOLLECTION
  dimension:      XY
  bbox:           xmin: NA ymin: NA xmax: NA ymax: NA
  epsg (SRID):    NA
  proj4string:    NA
  GEOMETRYCOLLECTION EMPTY
  > p_ = st_point(0:1)
  > ll = st_sfc(ls[[1]], p_)
  > ll & st_sfc(p_)
  Geometry set for 2 features 
  geometry type:  POINT
  dimension:      XY
  bbox:           xmin: 0 ymin: 1 xmax: 0 ymax: 1
  epsg (SRID):    NA
  proj4string:    NA
  POINT (0 1)
  POINT (0 1)
  > ll | st_sfc(p_)
  Geometry set for 2 features 
  geometry type:  GEOMETRY
  dimension:      XY
  bbox:           xmin: 0 ymin: 0 xmax: 0 ymax: 1
  epsg (SRID):    NA
  proj4string:    NA
  LINESTRING (0 0, 0 1)
  POINT (0 1)
  > ll %/% st_sfc(p_)
  Geometry set for 2 features  (with 1 geometry empty)
  geometry type:  GEOMETRY
  dimension:      XY
  bbox:           xmin: 0 ymin: 0 xmax: 0 ymax: 1
  epsg (SRID):    NA
  proj4string:    NA
  LINESTRING (0 0, 0 1)
  GEOMETRYCOLLECTION EMPTY
  > ll == st_sfc(p_)
  [1] FALSE  TRUE
  > ll != st_sfc(p_)
  [1]  TRUE FALSE
  > 
  > 
  > str(x)
  sfc_POINT of length 2; first list element:  'XY' num [1:2] -90 35
  > nc = st_read(system.file("shape/nc.shp", package="sf"), quiet = TRUE)
  > str(nc)
  Classes 'sf' and 'data.frame':	100 obs. of  15 variables:
   $ AREA     : num  0.114 0.061 0.143 0.07 0.153 0.097 0.062 0.091 0.118 0.124 ...
   $ PERIMETER: num  1.44 1.23 1.63 2.97 2.21 ...
   $ CNTY_    : num  1825 1827 1828 1831 1832 ...
   $ CNTY_ID  : num  1825 1827 1828 1831 1832 ...
   $ NAME     : Factor w/ 100 levels "Alamance","Alexander",..: 5 3 86 27 66 46 15 37 93 85 ...
   $ FIPS     : Factor w/ 100 levels "37001","37003",..: 5 3 86 27 66 46 15 37 93 85 ...
   $ FIPSNO   : num  37009 37005 37171 37053 37131 ...
   $ CRESS_ID : int  5 3 86 27 66 46 15 37 93 85 ...
   $ BIR74    : num  1091 487 3188 508 1421 ...
   $ SID74    : num  1 0 5 1 9 7 0 0 4 1 ...
   $ NWBIR74  : num  10 10 208 123 1066 ...
   $ BIR79    : num  1364 542 3616 830 1606 ...
   $ SID79    : num  0 3 6 2 3 5 2 2 2 5 ...
   $ NWBIR79  : num  19 12 260 145 1197 ...
   $ geometry :sfc_MULTIPOLYGON of length 100; first list element: List of 1
    ..$ :List of 1
    .. ..$ : num [1:27, 1:2] -81.5 -81.5 -81.6 -81.6 -81.7 ...
    ..- attr(*, "class")= chr  "XY" "MULTIPOLYGON" "sfg"
   - attr(*, "sf_column")= chr "geometry"
   - attr(*, "agr")= Factor w/ 3 levels "constant","aggregate",..: NA NA NA NA NA NA NA NA NA NA ...
    ..- attr(*, "names")= chr  "AREA" "PERIMETER" "CNTY_" "CNTY_ID" ...
  > st_as_sfc(st_bbox(nc))
  Geometry set for 1 feature 
  geometry type:  POLYGON
  dimension:      XY
  bbox:           xmin: -84.32385 ymin: 33.88199 xmax: -75.45698 ymax: 36.58965
  epsg (SRID):    4267
  proj4string:    +proj=longlat +datum=NAD27 +no_defs
  POLYGON ((-84.32385 33.88199, -75.45698 33.8819...
  > 
  > st_agr("constant")
  [1] constant
  Levels: constant aggregate identity
  > st_agr()
  [1] <NA>
  Levels: constant aggregate identity
  > x <- st_sf(a = 1:2, b = 3:4, geom = x, agr = c("constant", "aggregate"))
  > suppressPackageStartupMessages(library(dplyr))
  > y <- x %>% st_set_agr("constant")
  > y
  Simple feature collection with 2 features and 2 fields
  Attribute-geometry relationship: 2 constant, 0 aggregate, 0 identity
  geometry type:  POINT
  dimension:      XY
  bbox:           xmin: -90 ymin: 35 xmax: -80 ymax: 36
  epsg (SRID):    4267
  proj4string:    +proj=longlat +ellps=clrk66 +nadgrids=@conus,@alaska,@ntv2_0.gsb,@ntv1_can.dat +no_defs
    a b           geom
  1 1 3 POINT (-90 35)
  2 2 4 POINT (-80 36)
  > 
  > sf1 <- st_sf(a = c("x", "y"), geom = st_sfc(st_point(3:4), st_point(3:4)))
  > sf1[names(sf1)]
  Simple feature collection with 2 features and 1 field
  geometry type:  POINT
  dimension:      XY
  bbox:           xmin: 3 ymin: 4 xmax: 3 ymax: 4
  epsg (SRID):    NA
  proj4string:    NA
    a        geom
  1 x POINT (3 4)
  2 y POINT (3 4)
  > 
  > st_bbox(sf1)
  xmin ymin xmax ymax 
     3    4    3    4 
  > bb = st_bbox(nc)
  > bb
       xmin      ymin      xmax      ymax 
  -84.32385  33.88199 -75.45698  36.58965 
  > st_crs(bb)
  Coordinate Reference System:
    EPSG: 4267 
    proj4string: "+proj=longlat +datum=NAD27 +no_defs"
  > st_bbox(c(xmin = 16.1, xmax = 16.6, ymin = 48.6, ymax = 47.9), crs = st_crs(4326))
  xmin ymin xmax ymax 
  16.1 48.6 16.6 47.9 
  > st_bbox(c(xmin = 16.1, xmax = 16.6, ymin = 48.6, ymax = 47.9), crs = 4326)
  xmin ymin xmax ymax 
  16.1 48.6 16.6 47.9 
  > 
  > bb$xrange
       xmin      xmax 
  -84.32385 -75.45698 
  > bb$yrange
      ymin     ymax 
  33.88199 36.58965 
  > bb$xmin
       xmin 
  -84.32385 
  > bb$ymin
      ymin 
  33.88199 
  > bb$xmax
       xmax 
  -75.45698 
  > bb$ymax
      ymax 
  36.58965 
  > try(bb$foo)
  Error in `$.bbox`(bb, foo) : unsupported name
  > 
  > # merge:
  > a = data.frame(a = 1:3, b = 5:7)
  > st_geometry(a) = st_sfc(st_point(c(0,0)), st_point(c(1,1)), st_point(c(2,2)))
  > b = data.frame(x = c("a", "b", "c"), b = c(2,5,6))
  > merge(a, b)
  Simple feature collection with 2 features and 3 fields
  geometry type:  POINT
  dimension:      XY
  bbox:           xmin: 0 ymin: 0 xmax: 1 ymax: 1
  epsg (SRID):    NA
  proj4string:    NA
    b a x    geometry
  1 5 1 b POINT (0 0)
  2 6 2 c POINT (1 1)
  > merge(a, b, all = TRUE)
  Simple feature collection with 4 features and 3 fields (with 1 geometry empty)
  geometry type:  GEOMETRY
  dimension:      XY
  bbox:           xmin: 0 ymin: 0 xmax: 2 ymax: 2
  epsg (SRID):    NA
  proj4string:    NA
    b  a    x                 geometry
  1 2 NA    a GEOMETRYCOLLECTION EMPTY
  2 5  1    b              POINT (0 0)
  3 6  2    c              POINT (1 1)
  4 7  3 <NA>              POINT (2 2)
  > 
  > # joins:
  > inner_join(a, b)
  Joining, by = "b"
  Simple feature collection with 2 features and 3 fields
  geometry type:  POINT
  dimension:      XY
  bbox:           xmin: 0 ymin: 0 xmax: 1 ymax: 1
  epsg (SRID):    NA
  proj4string:    NA
    a b x    geometry
  1 1 5 b POINT (0 0)
  2 2 6 c POINT (1 1)
  > left_join(a, b)
  Joining, by = "b"
  Simple feature collection with 3 features and 3 fields
  geometry type:  POINT
  dimension:      XY
  bbox:           xmin: 0 ymin: 0 xmax: 2 ymax: 2
  epsg (SRID):    NA
  proj4string:    NA
    a b    x    geometry
  1 1 5    b POINT (0 0)
  2 2 6    c POINT (1 1)
  3 3 7 <NA> POINT (2 2)
  > right_join(a, b)
  Joining, by = "b"
  Simple feature collection with 3 features and 3 fields (with 1 geometry empty)
  geometry type:  POINT
  dimension:      XY
  bbox:           xmin: 0 ymin: 0 xmax: 1 ymax: 1
  epsg (SRID):    NA
  proj4string:    NA
     a b x    geometry
  1 NA 2 a POINT EMPTY
  2  1 5 b POINT (0 0)
  3  2 6 c POINT (1 1)
  > full_join(a, b)
  Joining, by = "b"
  Simple feature collection with 4 features and 3 fields (with 1 geometry empty)
  geometry type:  POINT
  dimension:      XY
  bbox:           xmin: 0 ymin: 0 xmax: 2 ymax: 2
  epsg (SRID):    NA
  proj4string:    NA
     a b    x    geometry
  1  1 5    b POINT (0 0)
  2  2 6    c POINT (1 1)
  3  3 7 <NA> POINT (2 2)
  4 NA 2    a POINT EMPTY
  > semi_join(a, b)
  Joining, by = "b"
  Simple feature collection with 2 features and 2 fields
  geometry type:  POINT
  dimension:      XY
  bbox:           xmin: 0 ymin: 0 xmax: 1 ymax: 1
  epsg (SRID):    NA
  proj4string:    NA
    a b    geometry
  1 1 5 POINT (0 0)
  2 2 6 POINT (1 1)
  > anti_join(a, b)
  Joining, by = "b"
  Simple feature collection with 1 feature and 2 fields
  geometry type:  POINT
  dimension:      XY
  bbox:           xmin: 2 ymin: 2 xmax: 2 ymax: 2
  epsg (SRID):    NA
  proj4string:    NA
    a b    geometry
  1 3 7 POINT (2 2)
  > 
  > # st_joins:
  > a = st_sf(a = 1:3,
  +  geom = st_sfc(st_point(c(1,1)), st_point(c(2,2)), st_point(c(3,3))))
  > b = st_sf(a = 11:14,
  +  geom = st_sfc(st_point(c(10,10)), st_point(c(2,2)), st_point(c(2,2)), st_point(c(3,3))))
  > st_join(a, b)
  Simple feature collection with 4 features and 2 fields
  geometry type:  POINT
  dimension:      XY
  bbox:           xmin: 1 ymin: 1 xmax: 3 ymax: 3
  epsg (SRID):    NA
  proj4string:    NA
      a.x a.y        geom
  1     1  NA POINT (1 1)
  2     2  12 POINT (2 2)
  2.1   2  13 POINT (2 2)
  3     3  14 POINT (3 3)
  > st_join(a, b, left = FALSE)
  Simple feature collection with 3 features and 2 fields
  geometry type:  POINT
  dimension:      XY
  bbox:           xmin: 2 ymin: 2 xmax: 3 ymax: 3
  epsg (SRID):    NA
  proj4string:    NA
      a.x a.y        geom
  2     2  12 POINT (2 2)
  2.1   2  13 POINT (2 2)
  3     3  14 POINT (3 3)
  > # deprecated:
  > try(x <- st_join(a, b, FUN = mean))
  Error in st_join(a, b, FUN = mean) : 
    for aggregation/summarising after st_join, see examples in ?st_join
  In addition: Warning message:
  'st_join' is deprecated.
  Use 'aggregate' instead.
  See help("Deprecated") 
  > # st_join, largest = TRUE:
  > nc <- st_transform(st_read(system.file("shape/nc.shp", package="sf")), 2264)                
  Reading layer `nc' from data source `/home/hornik/tmp/R.check/r-devel-clang/Work/build/Packages/sf/shape/nc.shp' using driver `ESRI Shapefile'
  Simple feature collection with 100 features and 14 fields
  geometry type:  MULTIPOLYGON
  dimension:      XY
  bbox:           xmin: -84.32385 ymin: 33.88199 xmax: -75.45698 ymax: 36.58965
  epsg (SRID):    4267
  proj4string:    +proj=longlat +datum=NAD27 +no_defs
  > gr = st_sf(
  +     label = apply(expand.grid(1:10, LETTERS[10:1])[,2:1], 1, paste0, collapse = " "),
  +     geom = st_make_grid(nc))
  > gr$col = sf.colors(10, categorical = TRUE, alpha = .3)
  > # cut, to check, NA's work out:
  > gr = gr[-(1:30),]
  > st_join(nc, gr, largest = TRUE)
  Simple feature collection with 100 features and 16 fields
  geometry type:  MULTIPOLYGON
  dimension:      XY
  bbox:           xmin: 406262.2 ymin: 48374.87 xmax: 3052887 ymax: 1044158
  epsg (SRID):    2264
  proj4string:    +proj=lcc +lat_1=36.16666666666666 +lat_2=34.33333333333334 +lat_0=33.75 +lon_0=-79 +x_0=609601.2192024384 +y_0=0 +ellps=GRS80 +towgs84=0,0,0,0,0,0,0 +units=us-ft +no_defs
  First 10 features:
      AREA PERIMETER CNTY_ CNTY_ID        NAME  FIPS FIPSNO CRESS_ID BIR74 SID74
  1  0.114     1.442  1825    1825        Ashe 37009  37009        5  1091     1
  2  0.061     1.231  1827    1827   Alleghany 37005  37005        3   487     0
  3  0.143     1.630  1828    1828       Surry 37171  37171       86  3188     5
  4  0.070     2.968  1831    1831   Currituck 37053  37053       27   508     1
  5  0.153     2.206  1832    1832 Northampton 37131  37131       66  1421     9
  6  0.097     1.670  1833    1833    Hertford 37091  37091       46  1452     7
  7  0.062     1.547  1834    1834      Camden 37029  37029       15   286     0
  8  0.091     1.284  1835    1835       Gates 37073  37073       37   420     0
  9  0.118     1.421  1836    1836      Warren 37185  37185       93   968     4
  10 0.124     1.428  1837    1837      Stokes 37169  37169       85  1612     1
     NWBIR74 BIR79 SID79 NWBIR79 label       col                       geometry
  1       10  1364     0      19  A  4 #fb80724d MULTIPOLYGON (((1270814 913...
  2       10   542     3      12  A  4 #fb80724d MULTIPOLYGON (((1340555 959...
  3      208  3616     6     260  A  5 #80b1d34d MULTIPOLYGON (((1570591 910...
  4      123   830     2     145  A 10 #bc80bd4d MULTIPOLYGON (((2881208 948...
  5     1066  1606     3    1197  A  8 #fccde54d MULTIPOLYGON (((2525701 911...
  6      954  1838     5    1237  A  9 #d9d9d94d MULTIPOLYGON (((2665113 911...
  7      115   350     2     139  A 10 #bc80bd4d MULTIPOLYGON (((2881208 948...
  8      254   594     2     371  A  9 #d9d9d94d MULTIPOLYGON (((2717989 951...
  9      748  1190     2     844  A  8 #fccde54d MULTIPOLYGON (((2203890 914...
  10     160  2038     5     176  A  5 #80b1d34d MULTIPOLYGON (((1697624 911...
  Warning message:
  attribute variables are assumed to be spatially constant throughout all geometries 
  > 
  > # rbind:
  > x = st_sf(a = 1:2, geom = st_sfc(list(st_point(0:1), st_point(0:1)), crs = 4326))
  > rbind(x, x, x)
  Simple feature collection with 6 features and 1 field
  geometry type:  POINT
  dimension:      XY
  bbox:           xmin: 0 ymin: 1 xmax: 0 ymax: 1
  epsg (SRID):    4326
  proj4string:    +proj=longlat +datum=WGS84 +no_defs
    a        geom
  1 1 POINT (0 1)
  2 2 POINT (0 1)
  3 1 POINT (0 1)
  4 2 POINT (0 1)
  5 1 POINT (0 1)
  6 2 POINT (0 1)
  > nc2 = rbind(nc[1:50, ], nc[51:100, ])
  > all.equal(nc, nc2)
  [1] TRUE
  > 
  > # st_sample:
  > set.seed(131)
  > options(digits=6)
  > x = st_sfc(st_polygon(list(rbind(c(0,1),c(90,1),c(90,90),c(0,90),c(0,1)))), crs = st_crs(4326))
  > #if (sf_extSoftVersion()["proj.4"] >= "4.9.0")
  >   (p <- st_sample(x, 10))
  although coordinates are longitude/latitude, st_intersects assumes that they are planar
  Geometry set for 10 features 
  geometry type:  POINT
  dimension:      XY
  bbox:           xmin: 11.2448 ymin: 3.16385 xmax: 82.3451 ymax: 60.1703
  epsg (SRID):    4326
  proj4string:    +proj=longlat +datum=WGS84 +no_defs
  First 5 geometries:
  POINT (18.5793 25.2416)
  POINT (11.2448 20.8596)
  POINT (26.3946 60.1703)
  POINT (33.8202 19.146)
  POINT (76.1712 32.1029)
  > x = st_sfc(st_polygon(list(rbind(c(0,0),c(90,0),c(90,90),c(0,90),c(0,0))))) # NOT long/lat:
  > p <- st_sample(x, 10)
  > x = st_sfc(st_polygon(list(rbind(c(-180,-90),c(180,-90),c(180,90),c(-180,90),c(-180,-90)))),
  +  crs=st_crs(4326))
  > if (sf_extSoftVersion()["proj.4"] >= "4.9.0") # lwgeom breaks on this
  +   (p <- st_sample(x, 10))
  although coordinates are longitude/latitude, st_intersects assumes that they are planar
  Geometry set for 10 features 
  geometry type:  POINT
  dimension:      XY
  bbox:           xmin: -170.749 ymin: -64.7878 xmax: 172.194 ymax: 74.44
  epsg (SRID):    4326
  proj4string:    +proj=longlat +datum=WGS84 +no_defs
  First 5 geometries:
  POINT (48.8473 9.37328)
  POINT (48.5555 -52.7577)
  POINT (-102.634 -35.823)
  POINT (158.155 -47.3308)
  POINT (72.1339 -25.5048)
  > pt = st_multipoint(matrix(1:20,,2))
  > st_sample(p, 3)
  Geometry set for 1 feature 
  geometry type:  MULTIPOINT
  dimension:      XY
  bbox:           xmin: -15.7773 ymin: -22.4681 xmax: 143.823 ymax: 27.1614
  epsg (SRID):    NA
  proj4string:    NA
  MULTIPOINT (48.8473 9.37328, 143.823 27.1614, -...
  > ls = st_sfc(st_linestring(rbind(c(0,0),c(0,1))),
  +  st_linestring(rbind(c(0,0),c(.1,0))),
  +  st_linestring(rbind(c(0,1),c(.1,1))),
  +  st_linestring(rbind(c(2,2),c(2,2.00001))))
  > st_sample(ls, 80)
  Geometry set for 4 features  (with 1 geometry empty)
  geometry type:  MULTIPOINT
  dimension:      XY
  bbox:           xmin: 0 ymin: 0 xmax: 0.0914728 ymax: 1
  epsg (SRID):    NA
  proj4string:    NA
  MULTIPOINT (0 0.302591, 0 0.251439, 0 0.223373,...
  MULTIPOINT (0.0914728 0, 0.073852 0, 0.00320272...
  MULTIPOINT (0.0488222 1, 0.0716508 1, 0.0897947...
  MULTIPOINT EMPTY
  > st_sample(nc[1:2,], size = c(10,20))
  Geometry set for 29 features 
  geometry type:  POINT
  dimension:      XY
  bbox:           xmin: 1215230 ymin: 935867 xmax: 1428880 ymax: 1031900
  epsg (SRID):    2264
  proj4string:    +proj=lcc +lat_1=36.16666666666666 +lat_2=34.33333333333334 +lat_0=33.75 +lon_0=-79 +x_0=609601.2192024384 +y_0=0 +ellps=GRS80 +towgs84=0,0,0,0,0,0,0 +units=us-ft +no_defs
  First 5 geometries:
  POINT (1215227 1031901)
  POINT (1271918 979879)
  POINT (1264558 935867)
  POINT (1256623 949384)
  POINT (1222665 972639)
  > # try with LINES, LongLat, should generate a warning:
  > nc[1:2,] %>% st_transform(4326) %>% st_cast("MULTILINESTRING") %>% st_sample(size = c(10,20))
  although coordinates are longitude/latitude, st_sample assumes that they are planar
  although coordinates are longitude/latitude, st_sample assumes that they are planar
  Geometry set for 2 features 
  geometry type:  MULTIPOINT
  dimension:      XY
  bbox:           xmin: -81.7023 ymin: 36.238 xmax: -80.9089 ymax: 36.578
  epsg (SRID):    4326
  proj4string:    +proj=longlat +datum=WGS84 +no_defs
  MULTIPOINT (-81.7023 36.4641, -81.6845 36.3652,...
  MULTIPOINT (-80.9639 36.469, -80.9089 36.5654, ...
  > 
  > #class(st_bind_cols(nc, as.data.frame(nc)[1:3]))
  > class(dplyr::bind_cols(nc, as.data.frame(nc)[1:3]))
  [1] "sf"         "data.frame"
  > class(rbind(nc, nc))
  [1] "sf"         "data.frame"
  > class(cbind(nc, nc))
  [1] "sf"         "data.frame"
  > 
  > x = st_sfc(st_point(0:1), st_point(2:3))
  > x[c(NA,1,NA,2,NA)]
  Geometry set for 5 features  (with 3 geometries empty)
  geometry type:  POINT
  dimension:      XY
  bbox:           xmin: 0 ymin: 1 xmax: 2 ymax: 3
  epsg (SRID):    NA
  proj4string:    NA
  POINT EMPTY
  POINT (0 1)
  POINT EMPTY
  POINT (2 3)
  POINT EMPTY
  > 
  > # jitter
  > pts = st_centroid(st_geometry(nc))
  > plot(pts)
  > plot(st_jitter(pts, .05), add = TRUE, col = 'red')
  > plot(st_geometry(nc))
  > plot(st_jitter(st_geometry(nc), factor = .01), add = TRUE, col = '#ff8888')
  > st_jitter(st_sfc(st_point(0:1)), amount = .1)
  Geometry set for 1 feature 
  geometry type:  POINT
  dimension:      XY
  bbox:           xmin: 0.040877 ymin: 1.09605 xmax: 0.040877 ymax: 1.09605
  epsg (SRID):    NA
  proj4string:    NA
  POINT (0.040877 1.09605)
  > 
  > # st_bbox:
  > library(sp)
  > demo(meuse, ask = FALSE, echo = FALSE)
  > st_bbox(meuse)
    xmin   ymin   xmax   ymax 
  178605 329714 181390 333611 
  > library(raster)
  
  Attaching package: 'raster'
  
  The following object is masked from 'package:dplyr':
  
      select
  
  > st_bbox(raster(meuse.grid))
    xmin   ymin   xmax   ymax 
  178440 329600 181560 333760 
  > st_bbox(extent(raster()))
  xmin ymin xmax ymax 
  -180  -90  180   90 
  > 
  > # st_to_s2
  > x = sf:::st_to_s2(nc)
  Error in CPL_transform(x, crs$proj4string) : 
    OGRCreateCoordinateTransformation() returned NULL: PROJ.4 available?
  Calls: <Anonymous> ... st_transform -> st_transform.sfc -> structure -> CPL_transform
  In addition: Warning message:
  In CPL_transform(x, crs$proj4string) :
    GDAL Error 6: Failed to initialize PROJ pipeline from `+proj=lcc +lat_1=36.16666666666666 +lat_2=34.33333333333334 +lat_0=33.75 +lon_0=-79 +x_0=609601.2192024384 +y_0=0 +ellps=GRS80 +towgs84=0,0,0,0,0,0,0 +units=us-ft +no_defs' to `+proj=geocent +a=1 +b=1 +lat_ts=0.0 +lon_0=0.0 +x_0=0.0 +y_0=0 +k=1.0 +units=m +nadgrids=@null +wktext +no_defs': argument not numerical or out of range
  Execution halted