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 Nov. 1, 2021, 1:07 a.m.