R/gg_glm.R

#' Create a binomial regression plot in ggplot2.
#'
#' @keywords gg_glm
#' \code{gg_glm} helps create a ggplot2 binomial logistic regression plot. The function stores the arguments needed to produce the line and helps avoid
#' having to memorize the specific arguments.
#' Obviously, \code{ggplot2} must be installed to use this function.
#' @export
#' @param point_size size of points in the chart (default is 1.5)
#' @param line_size size of line (default is .55)
#' @param line_color color of the line (default is red)

gg_glm <- function(point_size = 1.5, line_size = .55, line_color = "red"){
    glm <- list(
        geom_point(size = point_size),
        geom_smooth(method = glm,
                    method.args = list(family = "binomial"),
                    se = FALSE, col = line_color, size = line_size)
    )
}
mistermichaelll/statcrewRC documentation built on June 1, 2019, 3:57 a.m.