Errors in running code in vignettes:
when running code in 'SimpleGuide.Rnw'

> options(width = 80, useFancyQuotes = "UTF-8")

> library(survival)

> library(rstpm2)
Loading required package: splines

Attaching package: ‘rstpm2’

The following object is masked from ‘package:survival’:

    colon


> brcancer <- transform(brcancer, recyear = rectime/365.24)

> fit.cox <- coxph(Surv(recyear, censrec == 1) ~ hormon, 
+     data = brcancer)

> summary(fit.cox)
Call:
coxph(formula = Surv(recyear, censrec == 1) ~ hormon, data = brcancer)

  n= 686, number of events= 299 

          coef exp(coef) se(coef)      z Pr(>|z|)   
hormon -0.3640    0.6949   0.1250 -2.911   0.0036 **
---
Signif. codes:  0 ‘***’ 0.001 ‘**’ 0.01 ‘*’ 0.05 ‘.’ 0.1 ‘ ’ 1

       exp(coef) exp(-coef) lower .95 upper .95
hormon    0.6949      1.439    0.5438    0.8879

Concordance= 0.543  (se = 0.014 )
Likelihood ratio test= 8.82  on 1 df,   p=0.003
Wald test            = 8.47  on 1 df,   p=0.004
Score (logrank) test = 8.57  on 1 df,   p=0.003


> fit <- stpm2(Surv(recyear, censrec == 1) ~ hormon, 
+     data = brcancer, df = 4)

> summary(fit)
Maximum likelihood estimation

Call:
stpm2(formula = Surv(recyear, censrec == 1) ~ hormon, data = brcancer, 
    df = 4)

Coefficients:
                           Estimate Std. Error z value     Pr(z)    
(Intercept)                -6.79773    0.72642 -9.3578 < 2.2e-16 ***
hormon                     -0.36406    0.12491 -2.9144  0.003563 ** 
nsx(log(recyear), df = 4)1  5.69995    0.71676  7.9523 1.830e-15 ***
nsx(log(recyear), df = 4)2  4.85614    0.48002 10.1166 < 2.2e-16 ***
nsx(log(recyear), df = 4)3 10.13327    1.41267  7.1731 7.331e-13 ***
nsx(log(recyear), df = 4)4  4.70626    0.33016 14.2545 < 2.2e-16 ***
---
Signif. codes:  0 ‘***’ 0.001 ‘**’ 0.01 ‘*’ 0.05 ‘.’ 0.1 ‘ ’ 1

-2 log L: 1684.412 

> eform(fit)[2, ]
exp(beta)     2.5 %    97.5 % 
0.6948520 0.5636727 0.8449352 

> plot(fit, newdata = data.frame(hormon = 0), xlab = "Time since diagnosis (years)")

> lines(fit, newdata = data.frame(hormon = 1), lty = 2)

> lines(survfit(Surv(recyear, censrec == 1) ~ hormon, 
+     data = brcancer), col = "blue", lty = 1:2)

> legend("topright", c("PH hormon=0", "PH hormon=1", 
+     "KM hormon=0", "KM hormon=1"), lty = 1:2, col = c("black", 
+     "black", "blue", "blue") .... [TRUNCATED] 

> library(ggplot2)

  When sourcing ‘SimpleGuide.R’:
Error: there is no package called ‘ggplot2’
Execution halted

  'Introduction.Rnw' using 'UTF-8'... OK
  'SimpleGuide.Rnw' using 'UTF-8'... failed
  'multistate.Rnw' using 'UTF-8'... OK
  'predictnl.Rnw' using 'UTF-8'... OK