R/local_mean.R

Defines functions loc_mean

Documented in loc_mean

#' location spending mean data
#' @param x a dataframe
#' @return k a by
#' @import tidyverse
#' @importFrom magrittr %>%
#' @importFrom dplyr select
#' @importFrom dplyr filter
#' @export
#' @importFrom stats na.omit

loc_mean <- function(x)
{
  x <- na.omit(x)
  t <- x %>% select('location','spending/y')
  k <- by(t$`spending/y`,t$location,mean)
  return(k)

}
phdornever/Bjj documentation built on Dec. 14, 2017, 1:58 p.m.