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

> base::assign(".ptime", proc.time(), pos = "CheckExEnv")
> ### Name: summary.emfrail
> ### Title: Summary for 'emfrail' objects
> ### Aliases: summary.emfrail
> 
> ### ** Examples
> 
> data("bladder")
> mod_gamma <- emfrail(Surv(start, stop, status) ~ treatment + cluster(id), bladder1)
Warning in Surv(start, stop, status) :
  Stop time must be > start time, NA created
Warning in Surv(start, stop, status) :
  Invalid status value, converted to NA
Warning in Surv(start, stop, status) :
  Stop time must be > start time, NA created
Warning in Surv(start, stop, status) :
  Invalid status value, converted to NA
> summary(mod_gamma)
Call: 
emfrail(formula = Surv(start, stop, status) ~ treatment + cluster(id), 
    data = bladder1)

Regression coefficients:
                      coef exp(coef) se(coef) adj. se      z    p
treatmentpyridoxine  0.141     1.151    0.339   0.339  0.415 0.68
treatmentthiotepa   -0.159     0.853    0.331   0.331 -0.480 0.63
Estimated distribution: gamma / left truncation: FALSE 

Fit summary:
Commenges-Andersen test for heterogeneity: p-val  4.08e-18 
no-frailty Log-likelihood: -800.212 
Log-likelihood: -763.58 
LRT: 1/2 * pchisq(73.3), p-val 5.67e-18

Frailty summary:
                   estimate lower 95% upper 95%
Var[Z]                1.197     0.717     1.921
Kendall's tau         0.374     0.264     0.490
Median concordance    0.377     0.261     0.501
E[logZ]              -0.707    -1.212    -0.399
Var[logZ]             2.152     1.031     4.607
theta                 0.835     0.521     1.395
Confidence intervals based on the likelihood function
> summary(mod_gamma, print_opts = list(frailty_verbose = FALSE))
Call: 
emfrail(formula = Surv(start, stop, status) ~ treatment + cluster(id), 
    data = bladder1)

Regression coefficients:
                      coef exp(coef) se(coef) adj. se      z    p
treatmentpyridoxine  0.141     1.151    0.339   0.339  0.415 0.68
treatmentthiotepa   -0.159     0.853    0.331   0.331 -0.480 0.63
Estimated distribution: gamma / left truncation: FALSE 

Fit summary:
Commenges-Andersen test for heterogeneity: p-val  4.08e-18 
no-frailty Log-likelihood: -800.212 
Log-likelihood: -763.58 
LRT: 1/2 * pchisq(73.3), p-val 5.67e-18

> 
> # plot the Empirical Bayes estimates of the frailty
> # easy way:
> plot(mod_gamma, type = "hist")
> 
> # a fancy graph:
> sum_mod <- summary(mod_gamma)
> 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

> library(ggplot2)
> 
> # Create a plot just with the points
> pl1 <- sum_mod$frail %>%
+   arrange(z) %>%
+   mutate(x = 1:n()) %>%
+   ggplot(aes(x = x, y = z)) +
+   geom_point()
> 
> # If the quantiles of the posterior distribution are
> # known, then error bars can be added:
> if(!is.null(sum_mod$frail$lower_q))
+   pl1 <- pl1 + geom_errorbar(aes(ymin = lower_q, ymax = upper_q), alpha = 0.5)
> 
> pl1
> 
> # The plot can be made interactive!
> # ggplot2 gives a warning about the "id" aesthetic, just ignore it
> pl2 <- sum_mod$frail %>%
+   arrange(z) %>%
+   mutate(x = 1:n()) %>%
+   ggplot(aes(x = x, y = z)) +
+   geom_point(aes(id = id))
Warning: Ignoring unknown aesthetics: id
> 
> if(!is.null(sum_mod$z$lower_q))
+   pl2 <- pl2 + geom_errorbar(aes(ymin = lower_q, ymax = upper_q, id = id), alpha = 0.5)
> 
> library(plotly)
Error in library(plotly) : there is no package called 'plotly'
Execution halted