discrets {seewave} | R Documentation |
This function transforms a numeric (time) series into a sequence of symbols
discrets(x, symb = 5, collapse = TRUE)
x |
a vector , a matrix (first column),
an object of class ts , Sample (left channel),
or Wave (left channel). |
symb |
the number of symbols used for the discretisation, can be set to 3 or 5 only. |
collapse |
logical, if TRUE , the symbols are pasted in a character string of length 1. |
The function partitions the numeric (time) series into a sequence of finite number of symbols.
This symbols result of the comparaison of each series value with its temporal neighbours.
They are two discretisations available:
when symb
is set to 3, each value will be replaced by either:
- I if the series is Increasing,
- D if the series is Decreasing,
- F if the series remains Flat,
when symb
is set to 5, each value will be replaced by either:
- I if the series is Increasing,
- D if the series is Decreasing,
- F if the series remains Flat,
- P if the series shows a Peak,
- T if the series shows a Trough.
A character string of length 1 if collapse
is TRUE
.
Otherwise, a character string of length n-2 if symbol=3
(the first and last values cannot be replaced with a symbol)
or n-1 if symbol=3
(the first value cannot be replaced with a symbol.)
Jerome Sueur sueur@mnhn.fr
Cazelles, B. 2004 Symbolic dynamics for identifying similarity between rhythms of ecological time series. Ecology Letters, 7: 755-763.
# a random variable discrets(rnorm(30)) discrets(rnorm(30),symb=3) # a frequency spectrum data(tico) spec1<-spec(tico,f=22050,at=0.2,plot=FALSE) discrets(spec1[,2])