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

> base::assign(".ptime", proc.time(), pos = "CheckExEnv")
> ### Name: apply_niche
> ### Title: apply niche model
> ### Aliases: apply_niche
> 
> ### ** Examples
> 
> ### example for event type data
> ## setup
> # using water depth as gradient
>  t = scenarioA$t_myr
>  wd = scenarioA$wd_m[,"8km"]
>  gc = approxfun(t, wd)
>  plot(t, gc(t), type = "l", xlab = "Time", ylab = "water depth [m]",
+   main = "gradient change with time")
>  # define niche
>  # preferred wd 10 m, tolerant to intermediate wd changes (standard deviation 10 m), non-terrestrial
>  niche_def = snd_niche(opt = 10, tol = 10, cutoff_val = 0)
>  plot(seq(-1, 50, by = 0.5), niche_def(seq(-1, 50, by = 0.5)), type = "l",
+  xlab = "water depth", ylab = "collection probability", main = "Niche def")
>  # niche pref with time
>  plot(t, niche_def(gc(t)), type = "l", xlab = "time",
+  ylab = "collection probability", main = "collection probability with time")
> 
>  ## simulate fossil occurrences
>  foss_occ = p3(rate = 100, from = 0, to = max(t))
>  # foss occ without niche pref
>  hist(foss_occ, xlab = "time")
>  foss_occ_niche = apply_niche(foss_occ, niche_def, gc)
>  # fossil occurrences with niche preference
>  hist(foss_occ_niche, xlab = "time")
> 
>  # see also
>  #vignette("event_data")
>  # for a detailed example on niche modeling for event type data
> 
>  ### example for pre_paleoTS objects
>  # we reuse the niche definition and gradient change from above!
>  x = stasis_sl(seq(0, max(t), length.out = 10))
>  plot(reduce_to_paleoTS(x), main = "Trait evolution before niche modeling")
>  y = apply_niche(x, niche_def, gc)
>  plot(reduce_to_paleoTS(y), main = "Trait evolution after niche modeling",
+  ylim = c(-2, 2))
>  # note that there are fewer sampling sites
>  # bc the taxon does not appear everywhere
>  # and there are fewer specimens per sampling site
> 
>  ### example for fossils objects
>  # we reuse the niche definition and gradient change from above
>  # simulate tree
>  tree = ape::rlineage(birth = 2, death = 0, Tmax = 2)
>  # create fossils object
>  f = FossilSim::sim.fossils.poisson(rate = 2, tree = tree)
Error in loadNamespace(x) : there is no package called ‘FossilSim’
Calls: loadNamespace -> withRestarts -> withOneRestart -> doWithOneRestart
Execution halted