#' Returns the time-domain signal, averaged over epochs that match cond_rgx
#' @param eeg EEG session
#' @param cond_rgx Regex that picks epochs over which function will be applied
#' @return EEG frequency time-domain signal, averaged over epochs (tibble)
evoked <- function(eeg, cond_rgx) {
use_epochs <- extract_epochs(eeg, cond_rgx)
sz <- epoch_size(use_epochs)
evoked_mat <- matrix(0, nrow=length(use_epochs), ncol=sz)
for(i in 1:length(use_epochs)) {
evoked_mat[i,] <- use_epochs[[i]]
}
evoked <- apply(evoked_mat, 2, mean)
time <- seq(0,sz/eeg@srate,length.out=sz)
return(tibble(
time = time,
evoked = evoked
))
}
#' This vector returns a logical vector indicating if artifact was present on any given epoch.
#' It uses the (...) algorithm.
detect_artifacts <- function(eeg, cond_rgx, at=10, from=NULL, to=NULL) {
}
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.