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

> base::assign(".ptime", proc.time(), pos = "CheckExEnv")
> ### Name: catalog_apply
> ### Title: LAScatalog processing engine
> ### Aliases: catalog_apply
> 
> ### ** Examples
> 
> # More examples might be avaible in the official lidR vignettes or
> # on the github wiki <http://jean-romain.github.io/lidR/wiki>
> 
> ## =========================================================================
> ## Example 1: detect all the tree tops over an entire catalog
> ## (this is basically the reproduction of existing lidR function 'tree_detection')
> ## =========================================================================
> 
> # 1. Build the user-defined function that analyzes each chunk of the catalog.
> # The function's first argument is a LAScluster object. The other arguments can be freely
> # choosen by the user.
> my_tree_detection_method <- function(cluster, ws)
+ {
+   # The cluster argument is a LAScluster object. The user does not need to know how it works.
+   # readLAS will load the region of interest (chunk) with a buffer around it, taking advantage of
+   # point cloud indexation if possible. The filter and select options are propagated automatically
+   las <- readLAS(cluster)
+   if (is.empty(las)) return(NULL)
+ 
+   # Find the tree tops using a user-developed method (here simply a LMF).
+   ttops <- tree_detection(las, lmf(ws))
+ 
+   # ttops is a SpatialPointsDataFrame that contains the tree tops in our region of interest
+   # plus the trees tops in the buffered area. We need to remove the buffer otherwise we will get
+   # some trees more than once.
+   bbox  <- raster::extent(cluster)
+   ttops <- raster::crop(ttops, bbox)
+ 
+   return(ttops)
+ }
> 
> # 2. Build a project (here, a single file catalog for the purposes of this dummmy example).
> LASfile <- system.file("extdata", "MixedConifer.laz", package="lidR")
> project <- readLAScatalog(LASfile)
Error in RGEOSUnaryPredFunc(spgeom, byid, "rgeos_isvalid") : 
  rgeos_convert_R2geos: invalid R class LAScatalog, unable to convert
Calls: readLAScatalog ... <Anonymous> -> isTRUE -> gIsValid -> RGEOSUnaryPredFunc
Execution halted