‘split’ divides the data in the vector ‘x’
into the groups defined by ‘f’. The replacement
forms replace values corresponding to such a division.
Here are listed ‘split’ methods defined for Time
objects defined in the timetools package
POSIXcti, etc.). See
sections below for complete list of methods.
1 2 3 4 5 6 7 8 9 10 11 12 13
## S4 method for signature 'ANY,POSIXctp' split(x, f, drop = FALSE, ...) ## S4 method for signature 'ANY,POSIXcti' split(x, f, drop = FALSE, ...) ## S4 method for signature 'ANY,POSIXst' split(x, f, drop = FALSE, ...) ## S4 method for signature 'TimeIntervalDataFrame,TimeIntervalDataFrame' split(x, f, ..., split.x=FALSE, keep.f=TRUE) ## S4 method for signature 'TimeIntervalDataFrame,POSIXcti' split(x, f, ..., split.x=FALSE) ## S4 method for signature 'TimeIntervalDataFrame,POSIXctp' split(x, f, ..., split.x=FALSE)
data frame containing values to be divided into groups. TimeIntervalDataFrame as data.frame.
Can be of different kind. Is used to defined the grouping. See details below.
logical indicating if levels that do not
occur should be dropped (if
further potential arguments passed to methods.
logical indicating if data in
logical indicating if
For each new split method defined in
timetools a short description is given
The value returned from ‘split’ is a list of vectors
containing the values for the groups. The components of
the list are named by the levels of
f (after converting
to a factor). The class of each element of the list is the one
of the initial
Since POSIXst, POSIXctp and POSIXcti objects are similar to vector it must be possible to split other type of objects against those ones.
'POSIXctp' is first cast as character (using format) and then the split is done.
'POSIXcti' is first
cast as character (using format) and then the split is done.
... argument is used to specify the format if needed.
'POSIXst' is first cast as numeric and then the split is done.
Split a TimeIntervalDataFrame into another TimeIntervalDataFrame.
The method takes each time interval of the first TimeIntervalDataFrame (TitDF) and searches with which time intervals of the second it intersects.
Each time interval of the first TItDF can intersect with none, one or several time intervals of the second TItDF. The arguments 'split.x' is defined to tell the method what to do :
if the time interval in the first TItDF (ti1) doesn't match any in the second TItDF, nothing to do
if it (ti1) matches one in the second TItDF (ti2) and is included inside it, it (ti1) is entirely taken in the final result
if it (ti1) intersects one and only one (ti2) inside the second TItDF, (ti1) is truncated to be included inside (ti2) if 'split.x' is TRUE and (ti1) is removed if 'split.x' is FALSE
if it (ti1) is over several time intervals of the second TItDF (ti2.a, ti2.b, etc.) :
if 'split.x' is TRUE, (ti1) is truncated into each ti2.x to be included inside each one
if 'split.x' is FALSE, (ti1) is removed.
Split a TimeIntervalDataFrame into a time period (of length 1). A TimeIntervalDataFrame is created (cf TimeIntervalDataFrame constructor) and the the above method is called.
Split a TimeIntervalDataFrame into time intervals (POSIXcti). It is exactly the same as splitting a TimeIntervalDataFrame into another except that 'f' has not data.
So a TimeIntervalDataFrame is created according to 'f' and the the above method is called.