R/gcenter.R

Defines functions gcenter

Documented in gcenter

#' Centering on grand-means
#'
#' This function allows you to center on grand-means.
#' @param var name of variable to be centered
#' @return A column in your dataframe (with grand-mean centered data)
#' @keywords centering
#' @export
#' @examples
#' \dontrun{data$centeredVAR<-gcenter(data$var)}


gcenter<-function(var){
  centered<- var-(mean(var, na.rm=T))
  return(centered)
}

Try the EMAtools package in your browser

Any scripts or data that you put into this service are public.

EMAtools documentation built on Aug. 4, 2017, 1:05 a.m.