#' Function has.interaction checks whether x is part of a term in terms. Original code at: http://stackoverflow.com/questions/19226816/how-can-i-view-the-source-code-for-a-function. Some changes have been done.
#'
#' @param x a logistic model (an object of class "glm", usually, a result of a call to glm).
#' @param terms is a vector with names of terms from a model.
#' @return Logical. TRUE if an interaction is a term in terms. Otherwise is FALSE.
has.interaction <- function(x,terms){
out <- sapply(terms,function(i){
sum(1-(strsplit(x,":")[[1]] %in% strsplit(i,":")[[1]]))==0
})
return(sum(out)>0)
}
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.