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

> ### Name: dplyr
> ### Title: Dplyr verb methods for sf objects
> ### Aliases: dplyr filter.sf dplyr arrange.sf dplyr distinct.sf dplyr
> ###   group_by.sf dplyr ungroup.sf dplyr mutate.sf dplyr transmute.sf dplyr
> ###   select.sf dplyr rename.sf dplyr slice.sf dplyr summarise.sf summarise
> ###   dplyr gather.sf dplyr spread.sf dplyr sample_n.sf dplyr
> ###   sample_frac.sf dplyr nest.sf dplyr separate.sf dplyr unite.sf dplyr
> ###   inner_join.sf dplyr left_join.sf dplyr right_join.sf dplyr
> ###   full_join.sf dplyr semi_join.sf dplyr anti_join.sf
> 
> ### ** Examples
> 
> library(dplyr)

Attaching package: 'dplyr'

The following objects are masked from 'package:stats':

    filter, lag

The following objects are masked from 'package:base':

    intersect, setdiff, setequal, union

> nc = st_read(system.file("shape/nc.shp", package="sf"))
Reading layer `nc' from data source `D:\temp\RtmpYVcEkM\RLIBS_2524c5508725d\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
> nc %>% filter(AREA > .1) %>% plot()
Warning: plotting the first 10 out of 14 attributes; use max.plot = 14 to plot all
> # plot 10 smallest counties in grey:
> st_geometry(nc) %>% plot()
> nc %>% select(AREA) %>% arrange(AREA) %>% slice(1:10) %>% plot(add = TRUE, col = 'grey')
> title("the ten counties with smallest area")
> nc[c(1:100, 1:10), ] %>% distinct() %>% nrow()
[1] 100
> nc$area_cl = cut(nc$AREA, c(0, .1, .12, .15, .25))
> nc %>% group_by(area_cl) %>% class()
[1] "sf"         "grouped_df" "tbl_df"     "tbl"        "data.frame"
> nc2 <- nc %>% mutate(area10 = AREA/10)
> nc %>% transmute(AREA = AREA/10, geometry = geometry) %>% class()
[1] "sf"         "data.frame"
> nc %>% transmute(AREA = AREA/10) %>% class()
[1] "sf"         "data.frame"
> nc %>% select(SID74, SID79) %>% names()
[1] "SID74"    "SID79"    "geometry"
> nc %>% select(SID74, SID79, geometry) %>% names()
[1] "SID74"    "SID79"    "geometry"
> nc %>% select(SID74, SID79) %>% class()
[1] "sf"         "data.frame"
> nc %>% select(SID74, SID79, geometry) %>% class()
[1] "sf"         "data.frame"
> nc2 <- nc %>% rename(area = AREA)
> nc %>% slice(1:2)
Simple feature collection with 2 features and 15 fields
geometry type:  MULTIPOLYGON
dimension:      XY
bbox:           xmin: -81.74107 ymin: 36.23436 xmax: -80.90344 ymax: 36.58965
epsg (SRID):    4267
proj4string:    +proj=longlat +datum=NAD27 +no_defs
# A tibble: 2 x 16
   AREA PERIMETER CNTY_ CNTY_ID      NAME   FIPS FIPSNO CRESS_ID BIR74 SID74
  <dbl>     <dbl> <dbl>   <dbl>    <fctr> <fctr>  <dbl>    <int> <dbl> <dbl>
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
# ... with 6 more variables: NWBIR74 <dbl>, BIR79 <dbl>, SID79 <dbl>,
#   NWBIR79 <dbl>, area_cl <fctr>, geometry <simple_feature>
> nc$area_cl = cut(nc$AREA, c(0, .1, .12, .15, .25))
> nc.g <- nc %>% group_by(area_cl)
> nc.g %>% summarise(mean(AREA))
Simple feature collection with 4 features and 2 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
# A tibble: 4 x 3
      area_cl `mean(AREA)`          geometry
       <fctr>        <dbl>  <simple_feature>
1     (0,0.1]   0.07602857 <MULTIPOLYGON...>
2  (0.1,0.12]   0.11206667 <MULTIPOLYGON...>
3 (0.12,0.15]   0.13422727 <MULTIPOLYGON...>
4 (0.15,0.25]   0.19039286 <MULTIPOLYGON...>
> nc.g %>% summarise(mean(AREA)) %>% plot(col = grey(3:6 / 7))
> nc %>% as.data.frame %>% summarise(mean(AREA))
  mean(AREA)
1    0.12626
> library(tidyr)
> nc %>% select(SID74, SID79, geometry) %>% gather(VAR, SID, -geometry) %>% summary()
Error in melt_dataframe(data, id_idx - 1L, gather_idx - 1L, as.character(key_var),  : 
  STRING_PTR() can only be applied to a 'character', not a 'list'
Calls: %>% ... <Anonymous> -> gather.data.frame -> melt_dataframe -> .Call
Execution halted