View source: R/generic_utilities.R
nwin | R Documentation |
Calculate number of windows in a time-series with a given duration
nwin(x, WIN, INC, flex = FALSE, SR = frequency(x), return = c("number", "all"))
x |
either the duration in seconds of a time-series, or a rats or ts object |
flex |
if true the first and last windows are stretched so to have exactly length(x)/inc resulting windows |
SR |
the number of samples per second (i.e. frequency) |
return |
either "number", which returns the number of windows, or "all" which returns a data.frame with the start and end of each window. |
winSec |
the width of each window, in seconds |
incSec |
the amount of increment between each window (incSec == winSec gives non-overlapping windows) |
\._./\.^.-^\._./\.^.-^\._./\.^.-^\._./\.^.-^
|---------------o---------------|
|---------------o---------------|
|---------------o---------------|
|---------------o---------------|
Here you need to have at least half window before getting reliable values
Instead with flex:
\._./\.^.-^\._./\.^.-^\._./\.^.-^\._./\.^.-^
o---------------| <---FLEX WINDOW 1
|---o---------------| <---FLEX WINDOW 2
|-------o---------------| <---FLEX WINDOW 3
|-----------o---------------| <---FLEX WINDOW 4
|---------------o---------------| <---FIRST COMPLETE WINDOW
|---------------o---------------|
|---------------o---------------|
|---------------o---------------|
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.