f.secondly {tdata} | R Documentation |
Create a Second-ly
Frequency
Description
Use this function to create a frequency for time-series data that occurs every second in a day or a subset of a week.
Usage
f.secondly(day, second)
Arguments
day |
A 'Day-based' object of class |
second |
The index of the second in the day, which should be between 1 and 86400. |
Details
In order to use the as.frequency
function for this type of frequency,
you need the following information:
-
Character Format:
"YYYYMMDD:#"
(where # represents the value ofsecond
) -
Class Id:
se|...
(where '...' represents the 'class id' ofday
)
Value
An object of class ldtf
. It is also a list with the following members:
class |
Determines the class of this frequency. |
day |
Determines the |
second |
Determines the |
Examples
se0 <- f.secondly(f.daily(c(2023,5,16)),40032)
se0_value_str <- as.character(se0) # this will be '20230516:40032'.
se0_class_str <- get.class.id(se0)
# this will be 'se|d'. The second part (i.e., 'd') shows
# that this frequency is defined in a 'Daily' frequency.
se_new <- as.frequency("20231101:3", "se|i:wed-sat")
# Don't make the following mistakes:
mi_invalid <- try(as.frequency("20231101:3", "se|j:wed-sat"))
# invalid format in day-based frequency
mi_invalid <- try(f.secondly(f.daily(c(2023,5,16)),100000)) # invalid second
[Package tdata version 0.3.0 Index]