Running examples in ‘sf-Ex.R’ failed
The error most likely occurred in:

> ### Name: st_as_sf
> ### Title: Convert foreign object to an sf object
> ### Aliases: st_as_sf st_as_sf.data.frame st_as_sf.sf st_as_sf.sfc
> ###   st_as_sf.Spatial st_as_sf.map st_as_sf.ppp st_as_sf.psp st_as_sf.lpp
> 
> ### ** Examples
> 
> pt1 = st_point(c(0,1))
> pt2 = st_point(c(1,1))
> st_sfc(pt1, pt2)
Geometry set for 2 features 
geometry type:  POINT
dimension:      XY
bbox:           xmin: 0 ymin: 1 xmax: 1 ymax: 1
CRS:            NA
POINT (0 1)
POINT (1 1)
> d = data.frame(a = 1:2)
> d$geom = st_sfc(pt1, pt2)
> df = st_as_sf(d)
> d$geom = c("POINT(0 0)", "POINT(0 1)")
> df = st_as_sf(d, wkt = "geom")
> d$geom2 = st_sfc(pt1, pt2)
> st_as_sf(d) # should warn
Simple feature collection with 2 features and 2 fields
geometry type:  POINT
dimension:      XY
bbox:           xmin: 0 ymin: 1 xmax: 1 ymax: 1
CRS:            NA
  a       geom       geom2
1 1 POINT(0 0) POINT (0 1)
2 2 POINT(0 1) POINT (1 1)
> data(meuse, package = "sp")
> meuse_sf = st_as_sf(meuse, coords = c("x", "y"), crs = 28992, agr = "constant")
> meuse_sf[1:3,]
Simple feature collection with 3 features and 12 fields
Attribute-geometry relationship: 12 constant, 0 aggregate, 0 identity
geometry type:  POINT
dimension:      XY
bbox:           xmin: 181025 ymin: 333537 xmax: 181165 ymax: 333611
CRS:            EPSG:28992
  cadmium copper lead zinc  elev       dist   om ffreq soil lime landuse dist.m
1    11.7     85  299 1022 7.909 0.00135803 13.6     1    1    1      Ah     50
2     8.6     81  277 1141 6.983 0.01222430 14.0     1    1    1      Ah     30
3     6.5     68  199  640 7.800 0.10302900 13.0     1    1    1      Ah    150
               geometry
1 POINT (181072 333611)
2 POINT (181025 333558)
3 POINT (181165 333537)
> summary(meuse_sf)
    cadmium           copper            lead            zinc       
 Min.   : 0.200   Min.   : 14.00   Min.   : 37.0   Min.   : 113.0  
 1st Qu.: 0.800   1st Qu.: 23.00   1st Qu.: 72.5   1st Qu.: 198.0  
 Median : 2.100   Median : 31.00   Median :123.0   Median : 326.0  
 Mean   : 3.246   Mean   : 40.32   Mean   :153.4   Mean   : 469.7  
 3rd Qu.: 3.850   3rd Qu.: 49.50   3rd Qu.:207.0   3rd Qu.: 674.5  
 Max.   :18.100   Max.   :128.00   Max.   :654.0   Max.   :1839.0  
                                                                   
      elev             dist               om         ffreq  soil   lime   
 Min.   : 5.180   Min.   :0.00000   Min.   : 1.000   1:84   1:97   0:111  
 1st Qu.: 7.546   1st Qu.:0.07569   1st Qu.: 5.300   2:48   2:46   1: 44  
 Median : 8.180   Median :0.21184   Median : 6.900   3:23   3:12          
 Mean   : 8.165   Mean   :0.24002   Mean   : 7.478                        
 3rd Qu.: 8.955   3rd Qu.:0.36407   3rd Qu.: 9.000                        
 Max.   :10.520   Max.   :0.88039   Max.   :17.000                        
                                    NA's   :2                             
    landuse       dist.m                geometry  
 W      :50   Min.   :  10.0   POINT        :155  
 Ah     :39   1st Qu.:  80.0   epsg:28992   :  0  
 Am     :22   Median : 270.0   +proj=ster...:  0  
 Fw     :10   Mean   : 290.3                      
 Ab     : 8   3rd Qu.: 450.0                      
 (Other):25   Max.   :1000.0                      
 NA's   : 1                                       
> library(sp)
> x = rbind(c(-1,-1), c(1,-1), c(1,1), c(-1,1), c(-1,-1))
> x1 = 0.1 * x + 0.1
> x2 = 0.1 * x + 0.4
> x3 = 0.1 * x + 0.7
> y = x + 3
> y1 = x1 + 3
> y3 = x3 + 3
> m = matrix(c(3, 0), 5, 2, byrow = TRUE)
> z = x + m
> z1 = x1 + m
> z2 = x2 + m
> z3 = x3 + m
> p1 = Polygons(list( Polygon(x[5:1,]), Polygon(x2), Polygon(x3),
+    Polygon(y[5:1,]), Polygon(y1), Polygon(x1), Polygon(y3)), "ID1")
> p2 = Polygons(list( Polygon(z[5:1,]), Polygon(z2), Polygon(z3), Polygon(z1)),
+   "ID2")
> if (require("rgeos")) {
+   r = createSPComment(SpatialPolygons(list(p1,p2)))
+   comment(r)
+   comment(r@polygons[[1]])
+   scan(text = comment(r@polygons[[1]]), quiet = TRUE)
+   library(sf)
+   a = st_as_sf(r)
+   summary(a)
+ }
Loading required package: rgeos
rgeos version: 0.5-5, (SVN revision 640)
 GEOS runtime version: 3.6.4-CAPI-1.10.4 
 Linking to sp version: 1.4-5 
 Polygon checking: TRUE 

         geometry
 MULTIPOLYGON:2  
 epsg:NA     :0  
> demo(meuse, ask = FALSE, echo = FALSE)
> summary(st_as_sf(meuse))
    cadmium           copper            lead            zinc       
 Min.   : 0.200   Min.   : 14.00   Min.   : 37.0   Min.   : 113.0  
 1st Qu.: 0.800   1st Qu.: 23.00   1st Qu.: 72.5   1st Qu.: 198.0  
 Median : 2.100   Median : 31.00   Median :123.0   Median : 326.0  
 Mean   : 3.246   Mean   : 40.32   Mean   :153.4   Mean   : 469.7  
 3rd Qu.: 3.850   3rd Qu.: 49.50   3rd Qu.:207.0   3rd Qu.: 674.5  
 Max.   :18.100   Max.   :128.00   Max.   :654.0   Max.   :1839.0  
                                                                   
      elev             dist               om         ffreq  soil   lime   
 Min.   : 5.180   Min.   :0.00000   Min.   : 1.000   1:84   1:97   0:111  
 1st Qu.: 7.546   1st Qu.:0.07569   1st Qu.: 5.300   2:48   2:46   1: 44  
 Median : 8.180   Median :0.21184   Median : 6.900   3:23   3:12          
 Mean   : 8.165   Mean   :0.24002   Mean   : 7.478                        
 3rd Qu.: 8.955   3rd Qu.:0.36407   3rd Qu.: 9.000                        
 Max.   :10.520   Max.   :0.88039   Max.   :17.000                        
                                    NA's   :2                             
    landuse       dist.m                geometry  
 W      :50   Min.   :  10.0   POINT        :155  
 Ah     :39   1st Qu.:  80.0   epsg:NA      :  0  
 Am     :22   Median : 270.0   +proj=ster...:  0  
 Fw     :10   Mean   : 290.3                      
 Ab     : 8   3rd Qu.: 450.0                      
 (Other):25   Max.   :1000.0                      
 NA's   : 1                                       
> summary(st_as_sf(meuse.grid))
     part.a           part.b            dist        soil     ffreq   
 Min.   :0.0000   Min.   :0.0000   Min.   :0.0000   1:1665   1: 779  
 1st Qu.:0.0000   1st Qu.:0.0000   1st Qu.:0.1193   2:1084   2:1335  
 Median :0.0000   Median :1.0000   Median :0.2715   3: 354   3: 989  
 Mean   :0.3986   Mean   :0.6014   Mean   :0.2971                    
 3rd Qu.:1.0000   3rd Qu.:1.0000   3rd Qu.:0.4402                    
 Max.   :1.0000   Max.   :1.0000   Max.   :0.9926                    
          geometry   
 POINT        :3103  
 epsg:NA      :   0  
 +proj=ster...:   0  
                     
                     
                     
> summary(st_as_sf(meuse.area))
          geometry
 POLYGON      :1  
 epsg:NA      :0  
 +proj=ster...:0  
> summary(st_as_sf(meuse.riv))
          geometry
 POLYGON      :1  
 epsg:NA      :0  
 +proj=ster...:0  
> summary(st_as_sf(as(meuse.riv, "SpatialLines")))
          geometry
 LINESTRING   :1  
 epsg:NA      :0  
 +proj=ster...:0  
> pol.grd = as(meuse.grid, "SpatialPolygonsDataFrame")
> # summary(st_as_sf(pol.grd))
> # summary(st_as_sf(as(pol.grd, "SpatialLinesDataFrame")))
> if (require(spatstat)) {
+   g = st_as_sf(gorillas)
+   # select only the points:
+   g[st_is(g, "POINT"),]
+ }
Loading required package: spatstat
Loading required package: spatstat.data
Loading required package: spatstat.geom
spatstat.geom 1.65-5
Loading required package: spatstat.core
Loading required package: nlme
Loading required package: rpart
spatstat.core 1.65-5
Loading required package: spatstat.linnet

spatstat 2.0-1       (nickname: ‘Caution: contains small parts’) 
For an introduction to spatstat, type ‘beginner’ 

Error: 'as.owin' is not an exported object from 'namespace:spatstat'
Execution halted