#' Mark (tag) Observations in a Data Frame
#'
#' A minimal function to mark observations use in a prior run lm() model.
#'
#' @param obj Model object generated by the lm() function.
#'
#' @examples
#' mod_1 <- lm(hp ~ disp + wt, data=mtcars)
#' mtcars$In_mod1 <- tagObs(obj = mod_1)
#' @export
tagObs <- function(obj, tag=1){
mark <- rep(tag, nrow(get(paste(obj$call$data))))
mark[attr(obj$model,"na.action")] <- 0
mark
}
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.