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

> base::assign(".ptime", proc.time(), pos = "CheckExEnv")
> ### Name: rep_sample_n
> ### Title: Perform repeated sampling
> ### Aliases: rep_sample_n
> 
> ### ** Examples
> 
> suppressPackageStartupMessages(library(dplyr))
> suppressPackageStartupMessages(library(ggplot2))
> 
> # A virtual population of N = 10,010, of which 3091 are hurricanes
> population <- dplyr::storms %>%
+   select(status)
> 
> # Take samples of size n = 50 storms without replacement; do this 1000 times
> samples <- population %>%
+   rep_sample_n(size = 50, reps = 1000)
> samples
# A tibble: 50,000 x 2
# Groups:   replicate [1,000]
   replicate status             
       <int> <chr>              
 1         1 hurricane          
 2         1 hurricane          
 3         1 tropical storm     
 4         1 hurricane          
 5         1 hurricane          
 6         1 hurricane          
 7         1 tropical depression
 8         1 tropical storm     
 9         1 hurricane          
10         1 tropical depression
# … with 49,990 more rows
> 
> # Compute p_hats for all 1000 samples = proportion hurricanes
> p_hats <- samples %>%
+   group_by(replicate) %>%
+   summarize(prop_hurricane = mean(status == "hurricane"))
> p_hats
# A tibble: 1,000 x 2
   replicate prop_hurricane
       <int>          <dbl>
 1         1           0.36
 2         2           0.2 
 3         3           0.4 
 4         4           0.22
 5         5           0.34
 6         6           0.4 
 7         7           0.36
 8         8           0.26
 9         9           0.3 
10        10           0.28
# … with 990 more rows
> 
> # Plot sampling distribution
> ggplot(p_hats, aes(x = prop_hurricane)) +
+   geom_density() +
+   labs(x = "p_hat", y = "Number of samples",
+   title = "Sampling distribution of p_hat from 1000 samples of size 50")
Error in grid.Call.graphics(C_setviewport, vp, TRUE) : 
  VECTOR_ELT() can only be applied to a 'list', not a 'double'
Calls: <Anonymous> ... lapply -> FUN -> push.vp.viewport -> grid.Call.graphics
Execution halted