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

> ### Name: tidyverse
> ### Title: Tidyverse methods for sf objects (remove .sf suffix!)
> ### Aliases: tidyverse filter.sf arrange.sf group_by.sf ungroup.sf
> ###   mutate.sf transmute.sf select.sf rename.sf slice.sf summarise.sf
> ###   summarise distinct.sf gather.sf spread.sf sample_n.sf sample_frac.sf
> ###   nest.sf separate.sf unite.sf unnest.sf inner_join.sf left_join.sf
> ###   right_join.sf full_join.sf semi_join.sf 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\RtmpgxTkfV\RLIBS_148ec352f396\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$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
   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
  NWBIR74 BIR79 SID79 NWBIR79    area_cl                       geometry
1      10  1364     0      19 (0.1,0.12] MULTIPOLYGON (((-81.47276 3...
2      10   542     3      12    (0,0.1] MULTIPOLYGON (((-81.23989 3...
> 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
* <fct>             <dbl>                                     <MULTIPOLYGON [°]>
1 (0,0.1]          0.0760 (((-77.96073 34.18924, -77.96587 34.24229, -77.97528 ~
2 (0.1,0.12]       0.112  (((-84.29104 35.21054, -84.22594 35.2616, -84.17973 3~
3 (0.12,0.1~       0.134  (((-76.54427 34.58783, -76.55515 34.61066, -76.53775 ~
4 (0.15,0.2~       0.190  (((-76.64705 34.90633, -76.62562 34.89065, -76.75021 ~
> nc.g %>% summarise(mean(AREA)) %>% plot(col = grey(3:6 / 7))
> nc %>% as.data.frame %>% summarise(mean(AREA))
  mean(AREA)
1    0.12626
> nc[c(1:100, 1:10), ] %>% distinct() %>% nrow()
[1] 100
> library(tidyr)
> nc %>% select(SID74, SID79) %>% gather("VAR", "SID", -geometry) %>% summary()
     VAR                 SID                  geometry  
 Length:200         Min.   : 0.000   MULTIPOLYGON :200  
 Class :character   1st Qu.: 2.000   epsg:4267    :  0  
 Mode  :character   Median : 5.000   +proj=long...:  0  
                    Mean   : 7.515                      
                    3rd Qu.: 9.000                      
                    Max.   :57.000                      
> library(tidyr)
> nc$row = 1:100 # needed for spread to work
> nc %>% select(SID74, SID79, geometry, row) %>%
+ 	gather("VAR", "SID", -geometry, -row) %>%
+ 	spread(VAR, SID) %>% head()
Simple feature collection with 6 features and 3 fields
geometry type:  MULTIPOLYGON
dimension:      XY
bbox:           xmin: -81.74107 ymin: 36.07282 xmax: -75.77316 ymax: 36.58965
epsg (SRID):    4267
proj4string:    +proj=longlat +datum=NAD27 +no_defs
  row SID74 SID79                       geometry
1   1     1     0 MULTIPOLYGON (((-81.47276 3...
2   2     0     3 MULTIPOLYGON (((-81.23989 3...
3   3     5     6 MULTIPOLYGON (((-80.45634 3...
4   4     1     2 MULTIPOLYGON (((-76.00897 3...
5   5     9     3 MULTIPOLYGON (((-77.21767 3...
6   6     7     5 MULTIPOLYGON (((-76.74506 3...
> storms.sf = st_as_sf(storms, coords = c("long", "lat"), crs = 4326)
> x <- storms.sf %>% group_by(name, year) %>% nest
Error: Quosures can only be unquoted within a quasiquotation context.

  # Bad:
  list(!!myquosure)

  # Good:
  dplyr::mutate(data, !!myquosure)
Backtrace:
     x
  1. \-storms.sf %>% group_by(name, year) %>% nest
  2.   +-base::withVisible(eval(quote(`_fseq`(`_lhs`)), env, env))
  3.   \-base::eval(quote(`_fseq`(`_lhs`)), env, env)
  4.     \-base::eval(quote(`_fseq`(`_lhs`)), env, env)
  5.       \-`_fseq`(`_lhs`)
  6.         \-magrittr::freduce(value, `_function_list`)
  7.           +-base::withVisible(function_list[[k]](value))
  8.           \-function_list[[k]](value)
  9.             +-tidyr::nest(.)
 10.             \-sf:::nest.sf(.)
 11.               +-tidyr::nest(data, ..., .key = !!key)
 12.               +-tidyr:::nest.grouped_df(data, ..., .key = !!key)
 13.               | \-tidyr:::check_key(.key)
 14.               |   \-rlang::is_missing(.key)
 15.               \-rlang:::Ops.quosure(key)
Execution halted