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

> ### Name: plotspatialrd
> ### Title: Plot SpatialRD output
> ### Aliases: plotspatialrd
> 
> ### ** Examples
> 
> 
> points_samp.sf <- sf::st_sample(polygon_full, 1000) # create points
> # make it an sf object bc st_sample only created the geometry list-column (sfc):
> points_samp.sf <- sf::st_sf(points_samp.sf)
> # add a unique ID to each observation:
> points_samp.sf$id <- 1:nrow(points_samp.sf)
> # assign treatment:
> points_samp.sf$treated <- assign_treated(points_samp.sf, polygon_treated, id = "id")
Warning: attribute variables are assumed to be spatially constant throughout all geometries
> # first we define a variable for the number of "treated" and control
> NTr <- length(points_samp.sf$id[points_samp.sf$treated == 1])
> NCo <- length(points_samp.sf$id[points_samp.sf$treated == 0])
> # the treated areas get a 10 percentage point higher literacy rate
> points_samp.sf$education[points_samp.sf$treated == 1] <- 0.7
> points_samp.sf$education[points_samp.sf$treated == 0] <- 0.6
> # and we add some noise, otherwise we would obtain regression coeffictions with no standard errors
> points_samp.sf$education[points_samp.sf$treated == 1] <- rnorm(NTr, mean = 0, sd = .1) +
+   points_samp.sf$education[points_samp.sf$treated == 1]
> points_samp.sf$education[points_samp.sf$treated == 0] <- rnorm(NCo, mean = 0, sd = .1) +
+   points_samp.sf$education[points_samp.sf$treated == 0]
> 
> # create distance to cutoff
> points_samp.sf$dist2cutoff <- as.numeric(sf::st_distance(points_samp.sf, cut_off))
> 
> points_samp.sf$distrunning <- points_samp.sf$dist2cutoff
> # give the non-treated one's a negative score
> points_samp.sf$distrunning[points_samp.sf$treated == 0] <- -1 *
+  points_samp.sf$distrunning[points_samp.sf$treated == 0]
> 
> # create borderpoints
> borderpoints.sf <- discretise_border(cutoff = cut_off, n = 10)
> borderpoints.sf$id <- 1:nrow(borderpoints.sf)
> 
> # finally, carry out estimation alongside the boundary:
> results <- spatialrd(y = "education", data = points_samp.sf, cutoff.points = borderpoints.sf,
+ treated = "treated", minobs = 20, spatial.object = FALSE)
Warning in min(x) : no non-missing arguments to min; returning Inf
Warning in max(x) : no non-missing arguments to max; returning -Inf
Warning in rdrobust::rdrobust(data[[y]], x = data[["dist2cutoff"]], c = 0,  :
  c should be set within the range of x
Skipped one boundary point due to error, possibly not enough observations in local neighbourhood. Check vignette for FAQ!
Warning in min(x) : no non-missing arguments to min; returning Inf
Warning in max(x) : no non-missing arguments to max; returning -Inf
Warning in rdrobust::rdrobust(data[[y]], x = data[["dist2cutoff"]], c = 0,  :
  c should be set within the range of x
Skipped one boundary point due to error, possibly not enough observations in local neighbourhood. Check vignette for FAQ!
Warning in min(x) : no non-missing arguments to min; returning Inf
Warning in max(x) : no non-missing arguments to max; returning -Inf
Warning in rdrobust::rdrobust(data[[y]], x = data[["dist2cutoff"]], c = 0,  :
  c should be set within the range of x
Skipped one boundary point due to error, possibly not enough observations in local neighbourhood. Check vignette for FAQ!
Warning in min(x) : no non-missing arguments to min; returning Inf
Warning in max(x) : no non-missing arguments to max; returning -Inf
Warning in rdrobust::rdrobust(data[[y]], x = data[["dist2cutoff"]], c = 0,  :
  c should be set within the range of x
Skipped one boundary point due to error, possibly not enough observations in local neighbourhood. Check vignette for FAQ!
Warning in min(x) : no non-missing arguments to min; returning Inf
Warning in max(x) : no non-missing arguments to max; returning -Inf
Warning in rdrobust::rdrobust(data[[y]], x = data[["dist2cutoff"]], c = 0,  :
  c should be set within the range of x
Skipped one boundary point due to error, possibly not enough observations in local neighbourhood. Check vignette for FAQ!
Warning in min(x) : no non-missing arguments to min; returning Inf
Warning in max(x) : no non-missing arguments to max; returning -Inf
Warning in rdrobust::rdrobust(data[[y]], x = data[["dist2cutoff"]], c = 0,  :
  c should be set within the range of x
Skipped one boundary point due to error, possibly not enough observations in local neighbourhood. Check vignette for FAQ!
Warning in min(x) : no non-missing arguments to min; returning Inf
Warning in max(x) : no non-missing arguments to max; returning -Inf
Warning in rdrobust::rdrobust(data[[y]], x = data[["dist2cutoff"]], c = 0,  :
  c should be set within the range of x
Skipped one boundary point due to error, possibly not enough observations in local neighbourhood. Check vignette for FAQ!
Warning in min(x) : no non-missing arguments to min; returning Inf
Warning in max(x) : no non-missing arguments to max; returning -Inf
Warning in rdrobust::rdrobust(data[[y]], x = data[["dist2cutoff"]], c = 0,  :
  c should be set within the range of x
Skipped one boundary point due to error, possibly not enough observations in local neighbourhood. Check vignette for FAQ!
Warning in min(x) : no non-missing arguments to min; returning Inf
Warning in max(x) : no non-missing arguments to max; returning -Inf
Warning in rdrobust::rdrobust(data[[y]], x = data[["dist2cutoff"]], c = 0,  :
  c should be set within the range of x
Skipped one boundary point due to error, possibly not enough observations in local neighbourhood. Check vignette for FAQ!
Warning in min(x) : no non-missing arguments to min; returning Inf
Warning in max(x) : no non-missing arguments to max; returning -Inf
Warning in rdrobust::rdrobust(data[[y]], x = data[["dist2cutoff"]], c = 0,  :
  c should be set within the range of x
Skipped one boundary point due to error, possibly not enough observations in local neighbourhood. Check vignette for FAQ!
> 
> 
> plotspatialrd(results)
Error in `ggplot2::geom_point()`:
! Problem while computing aesthetics.
ℹ Error occurred in the 3rd layer.
Caused by error in `cut.default()`:
! 'x' must be numeric
Backtrace:
     ▆
  1. ├─SpatialRDD::plotspatialrd(results)
  2. │ └─cowplot::plot_grid(GRDD, GRDDrob, align = "v", nrow = 2)
  3. │   └─cowplot::align_plots(...)
  4. │     └─base::lapply(...)
  5. │       └─cowplot (local) FUN(X[[i]], ...)
  6. │         ├─cowplot::as_gtable(x)
  7. │         └─cowplot:::as_gtable.default(x)
  8. │           ├─cowplot::as_grob(plot)
  9. │           └─cowplot:::as_grob.ggplot(plot)
 10. │             └─ggplot2::ggplotGrob(plot)
 11. │               ├─ggplot2::ggplot_gtable(ggplot_build(x))
 12. │               │ └─ggplot2:::attach_plot_env(data$plot$plot_env)
 13. │               │   └─base::options(ggplot2_plot_env = env)
 14. │               ├─ggplot2::ggplot_build(x)
 15. │               └─ggplot2:::ggplot_build.ggplot(x)
 16. │                 └─ggplot2:::by_layer(...)
 17. │                   ├─rlang::try_fetch(...)
 18. │                   │ ├─base::tryCatch(...)
 19. │                   │ │ └─base (local) tryCatchList(expr, classes, parentenv, handlers)
 20. │                   │ │   └─base (local) tryCatchOne(expr, names, parentenv, handlers[[1L]])
 21. │                   │ │     └─base (local) doTryCatch(return(expr), name, parentenv, handler)
 22. │                   │ └─base::withCallingHandlers(...)
 23. │                   └─ggplot2 (local) f(l = layers[[i]], d = data[[i]])
 24. │                     └─l$compute_aesthetics(d, plot)
 25. │                       └─ggplot2 (local) compute_aesthetics(..., self = self)
 26. │                         └─base::lapply(aesthetics, eval_tidy, data = data, env = env)
 27. │                           └─rlang (local) FUN(X[[i]], ...)
 28. ├─base::cut(.data$p_Conv, c(-Inf, 0.11, Inf))
 29. ├─base::cut.default(.data$p_Conv, c(-Inf, 0.11, Inf))
 30. │ └─base::stop("'x' must be numeric")
 31. └─base::.handleSimpleError(...)
 32.   └─rlang (local) h(simpleError(msg, call))
 33.     └─handlers[[1L]](cnd)
 34.       └─cli::cli_abort(...)
 35.         └─rlang::abort(...)
Execution halted