R/mtcars_manipulation.R

Defines functions average_mpg

Documented in average_mpg

#' average_mpg
#'
#' This function is an example of pure function, that requires a package to
#' operates: dplyr in this case
#'
#' @param tbl
#'
#' @export
#' @import dplyr
average_mpg <- function(tbl) {
  tbl %>%
    group_by(cyl) %>%
    summarise(mean_mpg = mean(mpg))
}
andreamelloncelli/myShapes documentation built on Dec. 19, 2021, 2:35 a.m.