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

> base::assign(".ptime", proc.time(), pos = "CheckExEnv")
> ### Name: coxph.RT.a0
> ### Title: Fits Cox Regression with Adjustment for the Lack of Positivity
> ### Aliases: coxph.RT.a0
> 
> ### ** Examples
> 
> # loading AIDS data set
> library(gss)
> data(aids)
> s <- data.frame(age=aids$age, ageg=as.numeric(aids$age<=4), T=aids$incu, R=aids$infe)
> s$T[s$T==0] <- 0.5 # as in Kalbfeisch and Lawless (1989)
> 
> # analysis using adjusted estimating equations for a0=0.2
> sol.02 <- try(coxph.RT.a0(T~ageg, right=R, data=s, a0=0.2, bs=FALSE))
> sol.02
$Call
coxph.RT.a0(formula = T ~ ageg, right = R, data = s, a0 = 0.2, 
    bs = FALSE)

$n
[1] 295

$a0
[1] 0.2

$coef
    ageg 
2.893829 

$convergence
[1] 0

attr(,"class")
[1] "coxph.RT.a0"
> # for a0=0
> sol <- try(coxph.RT(T~ageg, right=R, data=s, bs=FALSE) )
> sol$summary # print the summary of fit based on the asymptotic SE estimate
         coef exp.coef       SE     CI.L     CI.U       pvalue pvalue.H1.b.gr0
ageg 2.691229 14.74979 0.347909 2.009339 3.373118 1.030473e-14    5.152366e-15
     pvalue.H1.b.le0
ageg               1
> 
> 
> # senstivity analysis for different values of a0
> a_ <- seq(0.05, 0.55, by=0.05)
> est <- NULL
> 
> for(q in 1:length(a_))
+ {
+   sol.a <- try(coxph.RT.a0(T~ageg, right=R, data=s, a0=a_[q], bs=FALSE))
+   if (sol.a$convergence!=0)
+   {
+     cat("a0=", a_[q], ". Error occurred in BBsolve.\n")
+   } else
+   {
+     cat("a=", a_[q]," ", " IPW.adj.est=", sol.a$coef, "\n")
+     est <- c(est, sol.a$coef)
+   }
+ }
a= 0.05    IPW.adj.est= 2.71473 
a= 0.1    IPW.adj.est= 2.771229 
a= 0.15    IPW.adj.est= 2.830804 
a= 0.2    IPW.adj.est= 2.893829 
a= 0.25    IPW.adj.est= 2.960753 
a= 0.3    IPW.adj.est= 3.032115 
a= 0.35    IPW.adj.est= 3.108578 
a= 0.4    IPW.adj.est= 3.190961 
a= 0.45    IPW.adj.est= 3.280298 
a= 0.5    IPW.adj.est= 3.377919 
a= 0.55    IPW.adj.est= 3.485576 
> require(ggplot2)
Loading required package: ggplot2
> res.d <- data.frame(a0=c(0, a_), beta=c(sol$coef, est))
> 
> p <- ggplot(res.d, aes(x=a0, y=beta)) +
+   geom_line() + geom_point() +
+   geom_hline(yintercept=0)
> p + xlab(expression( paste(a[0], "=P(T>", r['*']," | z=0)" , sep="")) )+
+   ylab(expression( paste(hat(beta), "(", a[0], ")" , sep="")) ) +
+   scale_x_continuous(breaks=res.d$a0, labels=res.d$a0) +
+   theme(axis.text.x = element_text(face="bold", angle=45),
+         axis.text.y = element_text(face="bold"))
Error in grid.Call.graphics(C_setviewport, vp, TRUE) : 
  VECTOR_ELT() can only be applied to a 'list', not a 'double'
Calls: <Anonymous> ... lapply -> FUN -> push.vp.viewport -> grid.Call.graphics
Execution halted