### from pscl package, may be useful
## convenience helper function
model_offset_2 <- function(x, terms = NULL, offset = TRUE)
## allow optionally different terms
## potentially exclude "(offset)"
{
if(is.null(terms)) terms <- attr(x, "terms")
offsets <- attr(terms, "offset")
if(length(offsets) > 0) {
ans <- if(offset) x$"(offset)" else NULL
if(is.null(ans)) ans <- 0
for(i in offsets) ans <- ans + x[[deparse(attr(terms, "variables")[[i + 1]])]]
ans
}
else {
ans <- if(offset) x$"(offset)" else NULL
}
if(!is.null(ans) && !is.numeric(ans)) stop("'offset' must be numeric")
ans
}
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.