R/zeroAdjust.R

Defines functions zeroAdjust

Documented in zeroAdjust

#' Zero adjust.
#'
#' Used with apply functions accross columns.
#' Calculation done on each sweep as a vector.
#'
#'
#'
#' @param x numeric vector
#' @param r range of samples to calculate mean from
#'
#' @export zeroAdjust
#' @examples
#' \dontrun{
#' Using the example dataset 'field'
#' dfs_ABF(field$ABF)[[1]][[1]] %>% zeroAdjust()
#'
#' }
zeroAdjust <- function(x, r = 1:1000) {

    zA <- mean(x[r])
    x <- x - zA

    return(x)

}
NRSC/nphys documentation built on Nov. 13, 2024, 2:12 a.m.