Description Usage Arguments Details Author(s) See Also Examples
Sampling rate of a TDR dataset
1 |
x |
The time sequence. |
type |
Should the result be returned in seconds ("period") or hertz ("frequence") ? |
Sampling interval taken as the greatest common divisor of observed intervals.
Yves Le Bras, Simon Wotherspoon
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 | time_reso(seq(0, 10, by = 1/0.5), type = "freq")
time_reso(seq(0, 10, by = 1), type = "freq")
time_reso(seq(0, 10, by = 1/2), type = "freq")
time_reso(seq(0, 10, by = 1/5), type = "freq")
time_reso(seq(0, 10, by = 1/16), type = "freq")
# Please notice that exact equality may not be always true
# due to realities of computer arithmetic
## Not run:
# Assuming a sufficient number of decimales...
repeat {
f <- runif(1, 0, 100)
tst <- seq(0, 10, by = 1/f)
if (length(tst) > 1) break
}
time_reso(tst, type = "f") == f # is TRUE in most cases
all.equal(time_reso(tst, type = "f"), f) # is TRUE
## End(Not run)
|
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.