Error(s) in re-building vignettes:
  ...
--- re-building ‘Introduction.Rmd’ using rmarkdown
Quitting from lines 347-355 (Introduction.Rmd) 
Error: processing vignette 'Introduction.Rmd' failed with diagnostics:
VECTOR_ELT() can only be applied to a 'list', not a 'double'
--- failed re-building ‘Introduction.Rmd’

--- re-building ‘Stata.Rmd’ using rmarkdown
--- finished re-building ‘Stata.Rmd’

--- re-building ‘TechnicalDetails.Rnw’ using knitr
  ordinary text without R code

label: model1 (with options) 
List of 1
 $ results: chr "asis"

   ~~~~~~~~~~~~~~~~~~~~~~~~~ R code chunk ~~~~~~~~~~~~~~~~~~~~~~~~~~ 
   library("gapminder")
   suppressPackageStartupMessages(library("stargazer"))
   gapminder[["pop"]] <- gapminder[["pop"]]/1e6
   gapminder[["loggdp"]] <- log(gapminder[["gdpPercap"]])
   m1 <- lm(pop ~ loggdp + lifeExp, data = gapminder)
   m2 <- lm(pop ~ loggdp * lifeExp, data = gapminder)
   stargazer(m1, m2, dep.var.labels = "Population Size",
             title = "Example OLS Regression Output", 
             label = "tab:model1") 
   ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 
##------ Fri Mar 29 20:26:40 2019 ------##

  ordinary text without R code

label: persp (with options) 
List of 2
 $ fig.cap: chr "Expected Population (millions) by GDP/Capita and Life Expectancy"
 $ fig.lab: chr "fig:persp"

   ~~~~~~~~~~~~~~~~~~~~~~~~~ R code chunk ~~~~~~~~~~~~~~~~~~~~~~~~~~ 
   library("margins")
   layout(matrix(1:2, nrow = 1))
   persp(m1, zlab = "", zlim = c(-180, 180), main = "Additive Only (Model 1)")
   persp(m2, zlab = "", zlim = c(-180, 180), main = "Interaction Model (Model 2)") 
   ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 
##------ Fri Mar 29 20:26:41 2019 ------##

  ordinary text without R code

label: cplot1 (with options) 
List of 2
 $ results: chr "show"
 $ fig.cap: chr "Marginal Effect of GDP per Capita on Population Size, as shown by Expected Value Plot"

   ~~~~~~~~~~~~~~~~~~~~~~~~~ R code chunk ~~~~~~~~~~~~~~~~~~~~~~~~~~ 
   local({
     c1 <- suppressWarnings(cplot(m1, "loggdp", n = 50, 
             xlab = "GDP Per Capita (Logged)",
             se.type = "shade",
             xlim = c(7,10), ylim = c(-30,80)))
     w <- c(which.min((c1[["xvals"]]-8)^2),
            which.min((c1[["xvals"]]-9)^2))
     # dashed
     segments(0, c1[w[2],"yvals"], 9, c1[w[2],"yvals"], lty = 2)
     segments(0, c1[w[1],"yvals"], 8, c1[w[1],"yvals"], lty = 2)
     segments(8, -30, 8, c1[w[1],"yvals"], lty = 2)
     segments(9, -30, 9, c1[w[2],"yvals"], lty = 2)
     
     # red
     segments(8, c1[w[1],"yvals"], 9, c1[w[2],"yvals"], 
              col = "red", lwd = 3)
     segments(8, c1[w[2],"yvals"], 9, c1[w[2],"yvals"], 
              col = "red", lwd = 3)
     segments(8, c1[w[2],"yvals"], 8, c1[w[1],"yvals"], 
              col = "red", lwd = 3)
     text(8, 20, expression(Delta(y) == -26.4), pos = 2, 
          cex = 2, col = "red")
     text(8.5, 0, expression(Delta(x) == 1), cex = 2, col = "red")
     text(9, 40, expression(ME(x) == -26.4), cex = 2, col = "red")
   }) 
   ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 
##------ Fri Mar 29 20:26:41 2019 ------##

  ordinary text without R code

label: deriv (with options) 
List of 2
 $ echo   : logi TRUE
 $ results: chr "show"

   ~~~~~~~~~~~~~~~~~~~~~~~~~ R code chunk ~~~~~~~~~~~~~~~~~~~~~~~~~~ 
   deriv(y ~ b1*x1 + b2*x2 + b3*x3 + b4*x1*x2 + 
             b5*x2*x3 + b6*x1*x3 + b7*x1*x2*x3, 
         c("x1", "x2", "x3")) 
   ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 
##------ Fri Mar 29 20:26:41 2019 ------##

  ordinary text without R code

label: deriv2 (with options) 
List of 2
 $ echo   : logi TRUE
 $ results: chr "show"

   ~~~~~~~~~~~~~~~~~~~~~~~~~ R code chunk ~~~~~~~~~~~~~~~~~~~~~~~~~~ 
   deriv(y ~ b1*x1 + b2*x1squared + b3*x2, c("x1", "x2")) 
   ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 
##------ Fri Mar 29 20:26:42 2019 ------##

  ordinary text without R code

label: numderiv1 (with options) 
List of 1
 $ fig.cap: chr "Approximation of Derivative via One-Sided Numerical Approach"

   ~~~~~~~~~~~~~~~~~~~~~~~~~ R code chunk ~~~~~~~~~~~~~~~~~~~~~~~~~~ 
   curve(x^2, from = -5, to = 4, lwd = 2, las = 1, 
        xlim = c(-1, 4), ylim = c(0,10), 
        xaxt = "n", yaxs = "i", yaxs = "i",
        ylab = "", bty = "l")
   axis(1, c(0, 1, 1.25, 1.5, 2, 3))
   text(-0.25, 1, expression(f(x) == x^2))
   mtext(expression(f(x)), 2, 2, las = 1)
   
   # vertical lines
   segments(1,0, 1,1, lty = 2)
   segments(1.25,0, 1.25,1.5625, lty = 2)
   segments(1.5,0, 1.5,2.25, lty = 2)
   segments(2,0, 2,4, lty = 2)
   segments(3,0, 3,9, lty = 2)
   
   # tangents
   segments(0,-1, 5,9, col = "blue", lwd = 2)
   segments(1,1, 1.25, 1.5625, col = "red", lwd = 2)
   segments(1,1, 1.5, 2.25, col = "red", lwd = 2)
   segments(1,1, 2, 4, col = "red", lwd = 2)
   segments(1,1, 3, 9, col = "red", lwd = 2)
   
   # text
   text(3.1, 9, expression(paste(frac(paste(Delta, y), paste(Delta, x)) == frac(f(3) - f(1), 2), " = 4")), pos = 4 )
   text(3.1, 4, expression(paste(frac(paste(Delta, y), paste(Delta, x)) == frac(f(2) - f(1), 1), " = 3")), pos = 4 )
   text(3.1, 2.5, expression(paste(frac(paste(Delta, y), paste(Delta, x)) == frac(f(1.5) - f(1), 0.5), " = 2.5")), pos = 4 )
   text(3.1, 1.5, expression(paste(frac(paste(Delta, y), paste(Delta, x)) == frac(f(1.25) - f(1), 0.25), " = 2.25")), pos = 4 )
   text(3.1, 0.5, "...", pos = 4) 
   ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 
##------ Fri Mar 29 20:26:42 2019 ------##

  ordinary text without R code

label: numderiv2 (with options) 
List of 1
 $ fig.cap: chr "Approximation of Derivative via Two-Sided Numerical Approach"

   ~~~~~~~~~~~~~~~~~~~~~~~~~ R code chunk ~~~~~~~~~~~~~~~~~~~~~~~~~~ 
   curve(x^2, from = -5, to = 4, lwd = 2, las = 1, 
        xlim = c(-1, 4), ylim = c(0,10), 
        xaxt = "n", yaxs = "i", yaxs = "i",
        ylab = "", bty = "l")
   abline(h = 0, col = "gray")
   axis(1, c(0, 0.5, 1, 1.5, 2, 3))
   text(-0.25, 1, expression(f(x) == x^2))
   mtext(expression(f(x)), 2, 2, las = 1)
   
   # vertical lines
   segments(1,0, 1,1, lty = 2)
   segments(1.5,0, 1.5,2.25, lty = 2)
   segments(2,0, 2,4, lty = 2)
   segments(3,0, 3,9, lty = 2)
   
   # tangents
   segments(0,-1, 5,9, col = "blue", lwd = 2)
   segments(0.5,0.25, 1.5,2.25, col = "red", lwd = 2)
   segments(0,0, 2,4, col = "red", lwd = 2)
   segments(-1,1, 3,9, col = "red", lwd = 2)
   
   # text
   text(3.1, 9, expression(paste(frac(paste(Delta, y), paste(Delta, x)) == frac(f(3) - f(-1), 4), " = 2")), pos = 4 )
   text(3.1, 4, expression(paste(frac(paste(Delta, y), paste(Delta, x)) == frac(f(2) - f(0), 2), " = 2")), pos = 4 )
   text(3.1, 2.5, expression(paste(frac(paste(Delta, y), paste(Delta, x)) == frac(f(1.5) - f(0.5), 1), " = 2")), pos = 4 )
   text(3.1, 0.5, "...", pos = 4) 
   ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 
##------ Fri Mar 29 20:26:42 2019 ------##

  ordinary text without R code

label: print (with options) 
List of 2
 $ echo   : logi TRUE
 $ results: chr "show"

   ~~~~~~~~~~~~~~~~~~~~~~~~~ R code chunk ~~~~~~~~~~~~~~~~~~~~~~~~~~ 
   str(mar2 <- margins(m2)) 
   ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 
##------ Fri Mar 29 20:26:42 2019 ------##

  ordinary text without R code

label: summary (with options) 
List of 2
 $ echo   : logi TRUE
 $ results: chr "show"

   ~~~~~~~~~~~~~~~~~~~~~~~~~ R code chunk ~~~~~~~~~~~~~~~~~~~~~~~~~~ 
   mar2
   summary(mar2) 
   ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 
##------ Fri Mar 29 20:26:42 2019 ------##

  ordinary text without R code

label: margins1 (with options) 
List of 2
 $ echo   : logi TRUE
 $ results: chr "show"

   ~~~~~~~~~~~~~~~~~~~~~~~~~ R code chunk ~~~~~~~~~~~~~~~~~~~~~~~~~~ 
   library("datasets")
   m <- lm(mpg ~ wt + am + factor(cyl), data = mtcars)
   margins(m)
   summary(margins(m)) 
   ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 
##------ Fri Mar 29 20:26:42 2019 ------##

  ordinary text without R code

label: margins2 (with options) 
List of 2
 $ echo   : logi TRUE
 $ results: chr "show"

   ~~~~~~~~~~~~~~~~~~~~~~~~~ R code chunk ~~~~~~~~~~~~~~~~~~~~~~~~~~ 
   m <- lm(mpg ~ wt * am + I(wt^2) * am, data = mtcars)
   summary(margins(m, at = list(am = 0:1))) 
   ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 
##------ Fri Mar 29 20:26:42 2019 ------##

  ordinary text without R code

label: margins3a (with options) 
List of 2
 $ echo   : logi TRUE
 $ results: chr "show"

   ~~~~~~~~~~~~~~~~~~~~~~~~~ R code chunk ~~~~~~~~~~~~~~~~~~~~~~~~~~ 
   m <- lm(mpg ~ wt * I(wt^2) * hp * I(hp^2), data = mtcars)
   margins(m) 
   ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 
##------ Fri Mar 29 20:26:43 2019 ------##

  ordinary text without R code

label: margins3b (with options) 
List of 2
 $ echo    : logi TRUE
 $ fig.show: chr "hold"

   ~~~~~~~~~~~~~~~~~~~~~~~~~ R code chunk ~~~~~~~~~~~~~~~~~~~~~~~~~~ 
   cplot(m, "wt")
   cplot(m, "hp") 
   ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 
##------ Fri Mar 29 20:26:43 2019 ------##

  ordinary text without R code

label: margins3c (with options) 
List of 2
 $ echo    : logi TRUE
 $ fig.show: chr "hold"

   ~~~~~~~~~~~~~~~~~~~~~~~~~ R code chunk ~~~~~~~~~~~~~~~~~~~~~~~~~~ 
   persp(m, "wt", "hp")
   image(m, "wt", "hp") 
   ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 
##------ Fri Mar 29 20:26:43 2019 ------##

  ordinary text without R code

label: margins3d (with options) 
List of 2
 $ echo   : logi TRUE
 $ results: chr "show"

   ~~~~~~~~~~~~~~~~~~~~~~~~~ R code chunk ~~~~~~~~~~~~~~~~~~~~~~~~~~ 
   m <- lm(mpg ~ wt + am + factor(cyl), data = mtcars)
   plot(margins(m)) 
   ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 
##------ Fri Mar 29 20:26:43 2019 ------##

  ordinary text without R code

label: margins3e (with options) 
List of 1
 $ echo: logi TRUE

   ~~~~~~~~~~~~~~~~~~~~~~~~~ R code chunk ~~~~~~~~~~~~~~~~~~~~~~~~~~ 
   m <- lm(mpg ~ wt * I(wt^2) * hp * I(hp^2), data = mtcars)
   cplot(m, "wt", what = "effect")
   persp(m, "wt", "hp", what = "effect", phi = 30)
   image(m, "wt", "hp", what = "effect") 
   ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 
##------ Fri Mar 29 20:26:43 2019 ------##

  ordinary text without R code

label: log1 (with options) 
List of 1
 $ results: chr "asis"

   ~~~~~~~~~~~~~~~~~~~~~~~~~ R code chunk ~~~~~~~~~~~~~~~~~~~~~~~~~~ 
   m3a <- lm(pop ~ loggdp, data = gapminder)
   m3b <- lm(pop ~ I(log(gdpPercap)), data = gapminder)
   stargazer(m3a, m3b, dep.var.labels = "Population Size",
             title = "Example of Log Transformation", 
             label = "tab:model3") 
   ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 
##------ Fri Mar 29 20:27:03 2019 ------##

  ordinary text without R code

label: log2 (with options) 
List of 2
 $ echo   : logi TRUE
 $ results: chr "show"

   ~~~~~~~~~~~~~~~~~~~~~~~~~ R code chunk ~~~~~~~~~~~~~~~~~~~~~~~~~~ 
   summary(margins(m3b)) 
   ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 
##------ Fri Mar 29 20:27:03 2019 ------##

  ordinary text without R code

label: log3 (with options) 
List of 2
 $ echo   : logi TRUE
 $ results: chr "show"

   ~~~~~~~~~~~~~~~~~~~~~~~~~ R code chunk ~~~~~~~~~~~~~~~~~~~~~~~~~~ 
   summary(margins(m3a)) 
   ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 
##------ Fri Mar 29 20:27:03 2019 ------##

  ordinary text without R code

Chunk summary:
  Average marginal effects 

mar2
summary(mar2)
Chunk summary:
  lm(formula = pop ~ loggdp * lifeExp, data = gapminder) 

mar2
summary(mar2)
Chunk margins1:
  Average marginal effects 

library("datasets")
m <- lm(mpg ~ wt + am + factor(cyl), data = mtcars)
margins(m)
summary(margins(m))
Chunk margins1:
  lm(formula = mpg ~ wt + am + factor(cyl), data = mtcars) 

library("datasets")
m <- lm(mpg ~ wt + am + factor(cyl), data = mtcars)
margins(m)
summary(margins(m))
Chunk margins3a:
  Average marginal effects 

m <- lm(mpg ~ wt * I(wt^2) * hp * I(hp^2), data = mtcars)
margins(m)
Chunk margins3a:
  lm(formula = mpg ~ wt * I(wt^2) * hp * I(hp^2), data = mtcars) 

m <- lm(mpg ~ wt * I(wt^2) * hp * I(hp^2), data = mtcars)
margins(m)

Number of messages:
message 
      6 
--- finished re-building ‘TechnicalDetails.Rnw’

SUMMARY: processing the following file failed:
  ‘Introduction.Rmd’

Error: Vignette re-building failed.
Execution halted