#' Neutralize one variable upon others
#'
#' @param factor The variable to neutralize.
#' @param ... Other variable to neutralize upon.
#'
#' @return The variable after neutralization. Same length of \code{factor}.
#' @export
#'
#' @examples
neutralize <- function(factor, ...) {
df <- tibble::tibble(factor, ...)
lm(factor ~ ., data = df, na.action = na.exclude) %>%
residuals() %>%
return()
}
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.