get.peaks: Get the time value of one or more peaks.

Description Usage Arguments Details Value Author(s) See Also Examples

View source: R/get.peaks.R

Description

Get the time value of one or more points of a time series by clicking on the location using a mouse. This function was designed to get the peaks of blinks and eye-movements, but could be used for any other type of time series. See section Details for more info on how to use it.

Usage

1
2
3
get.peaks(data, channel, trials = NULL, 
trial.cn = "Trial", time.cn = "Time", 
add.lines = NULL, ...)

Arguments

data

A data frame containing the data. Measurements for each channel/electrode should be arranged in columns with the channel/electrode to which it pertains as their names (e.g., Fp1, Fp2, AF3, AF4, ...).

channel

The channel from which time values for specific points on the time series are to be obtained.

trials

The trial(s) for which the function is to run through. Defaults to NULL, which means that the function will run though all the trials in the data frame.

trial.cn

The quoted column name containing the trial information. Defaults to "Trial".

time.cn

The quoted column name containing the time information. Defaults to "Time".

add.lines

A list of column names and colors pairs of the lines to be added to the plot. For example add.lines = list(c("MISC002", "red"), c("MWD", "blue")). Defaults to NULL.

...

Further arguments passed to plot, lines, and locator.

Details

The function is build on function locator. As such, get.peaks is only supported on screen devices such as X11, windows, and quartz. On other devices the call will do nothing.

For each one of the specified trials, the function plots the time course of EEG activity for one of the specified trials. The user then points to the desired location on the time series and clicks once with the left mouse button to fetch the coordinates. More than 1 point can be gathered this way. Once the user has finished selecting points, s/he presses on the right mouse button to move on to the next trial and repeat these steps until all of the trials specified in argument trials have been processed. Note that the y-coordinate of the selected points are irrelevant.

Value

A named list of length equal to length(trials). Each list element contains the time values corresponding to the locations where the user clicked. The names are of the for trialXXX, where XXX is a specific trial.

Author(s)

Antoine Tremblay, Dalhousie University, trea26@gmail.com

See Also

identify; dev.capabilities to see if it is supported; locator.

Examples

1
### See vignette for examples.

Example output

Loading required package: fastICA
Loading required package: mgcv
Loading required package: nlme
This is mgcv 1.8-27. For overview type 'help("mgcv-package")'.

icaOcularCorrection documentation built on May 29, 2017, 1:53 p.m.