R/source.channels.R

#' Wraps raw data stream to use withing pipelinenig functions
#' 
#' @param data matrix
#' @param samplingRate
#' @param timestamps You can specify timestamps, otherwise they will be calculated automatically starting from 0
source.channels <- function(data, samplingRate, timestamps=NULL){
  data <- as.matrix(data)

  if(is.null(timestamps)){
    timestamps <- seq(from=0, by=(1E9/samplingRate), length.out=nrow(data))
  }
  attr(data, 'TS') <- timestamps
  SI(data) <- SI.channels(channels = ncol(data), samplingRate = samplingRate)
  data
}
tz-lom/Resonance-Rproj documentation built on July 1, 2019, 4:53 p.m.