#' Truncate spikes
#'
#' It has been observed that the signal contains a lot of high-voltage spikes
#' distributed throughout the lenght of the read. This function truncates/clips
#' these spikes to a specified threshold value
#'
#' @param data Data that needs its spikes to be truncated
#' @param spike_threshold Threshold beyond which spikes will be clipped
#'
#' @return Same data as input but with spikes clipped
#'
#' @examples
#' \dontrun{
#'
#' truncate_spikes(data, 2)
#' }
#'
truncate_spikes <- function (data, spike_threshold){
data[data > spike_threshold] = spike_threshold
data[data < -spike_threshold] = -spike_threshold
return(data)
}
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.