Learn R Programming

STAR (version 0.3-7)

as.spikeTrain: Coerce, Test and Extract from spikeTrain Objects

Description

as.spikeTrain attempts to coerce a numeric vector to a spikeTrain object while is.spikeTrain tests if its argument is such an object. [.spikeTrain, extracts a subset of a spikeTrain object.

Usage

as.spikeTrain(x) is.spikeTrain(x) "["(x,i)

Arguments

x
An object to be coerced to or to test against a spikeTrain object or a spikeTrain object for [.
i
indices specifying elements to extract. No gaps are allowed.

Value

as.spikeTrain returns a spikeTrain object or an error.is.spikeTrain returns TRUE if its argument is a spikeTrain object and FALSE otherwise.[ returns a spikeTrain object or an error.

Details

A spikeTrain object is a numeric vector whose elements are strictly increasing (that is, something which can be interpreted as a sequence of times of successive events with no two events occurring at the same time). The extractor method, [ requires that the extracted elements are without gaps, an error is returned otherwise.

References

Perkel D. H., Gerstein, G. L. and Moore G. P. (1967) Neural Spike Trains and Stochastic Point Processes. I. The Single Spike Train. Biophys. J., 7: 391-418. http://www.pubmedcentral.nih.gov/articlerender.fcgi?tool=pubmed&pubmedid=4292791

See Also

plot.spikeTrain, print.spikeTrain, summary.spikeTrain

Examples

Run this code
## load CAL1S data
data(CAL1S)
## convert the data into spikeTrain objects
CAL1S <- lapply(CAL1S,as.spikeTrain)
## Are the list eleemnts now spikeTrain objects?
sapply(CAL1S, is.spikeTrain)
## look at the train of the 1st neuron
CAL1S[["neuron 1"]]
## look at the window 10-40 using the extractor function
CAL1S[["neuron 1"]][10 < CAL1S[["neuron 1"]] & CAL1S[["neuron 1"]] < 40] 

Run the code above in your browser using DataLab