discrets {seewave} | R Documentation |
This function transforms a numeric (time) series into a sequence of symbols
discrets(x, symb = 5, collapse = TRUE, plateau=1)
x |
a |
symb |
the number of symbols used for the discretisation, can be set to 3 or 5 only. |
collapse |
logical, if |
plateau |
a numeric vector of length 1 taking the values |
The function partitions the numeric (time) series into a sequence of finite number of symbols.
These 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.
The argument plateau
can be used to control the way a plateau
is encoded. A plateau is an elevated flat region that can be either
considered a 'flat peak' encoded as PF...FP (plateau
= 1
) or as an increase, a flat region and a decrease encoded as
IF...FD (plateau = 1
. The default value (plateau
= 1
) refers to Cazelles et al. (2004).
A character string of length 1 if collapse
is TRUE
.
Otherwise, a character string of length n-2 if symbol=5
(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, improved by Laurent Lellouch
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])