"SubtimeDataFrame"
Class to hold subtime data such a day of week, month of year, etc.
SubtimeDataFrame(when, data = NULL, ...)as.SubtimeDataFrame(x, unit, of, ...)
# S3 method for TimeInstantDataFrame
as.SubtimeDataFrame(x, unit, of, FUN=NULL, ...)
# S3 method for TimeIntervalDataFrame
as.SubtimeDataFrame(x, unit, of, FUN=NULL, cursor=NULL, ...)
# S4 method for SubtimeDataFrame
$(x, name)
# S4 method for SubtimeDataFrame
$(x, name) <- value
# S3 method for SubtimeDataFrame
[(x, i, j, drop=FALSE)
# S3 method for SubtimeDataFrame
[(x, i, j) <- value
# S4 method for SubtimeDataFrame
[[(x ,i, j, ...)
# S3 method for SubtimeDataFrame
[[(x, i, j) <- value
# S3 method for SubtimeDataFrame
merge(x, y, by, all=TRUE, sort=FALSE, ...)
# S3 method for SubtimeDataFrame
split(x, f, drop=FALSE, ...)
# S4 method for SubtimeDataFrame
lapply(X, FUN, ...)
# S4 method for SubtimeDataFrame
timezone(object)
# S4 method for SubtimeDataFrame
when(x, ...)
# S3 method for SubtimeDataFrame
unit(x, ...)
# S3 method for SubtimeDataFrame
of(x, ...)
# S4 method for SubtimeDataFrame
dim(x)
# S4 method for SubtimeDataFrame
length(x)
# S4 method for SubtimeDataFrame
names(x)
# S4 method for SubtimeDataFrame
names(x) <- value
# S4 method for SubtimeDataFrame
ncol(x)
# S4 method for SubtimeDataFrame
nrow(x)
# S3 method for SubtimeDataFrame
row.names(x)
# S3 method for SubtimeDataFrame
row.names(x) <- value
# S3 method for SubtimeDataFrame
print(x, ...)
# S3 method for SubtimeDataFrame
summary(object, ...)
# S3 method for SubtimeDataFrame
head(x, ...)
# S3 method for SubtimeDataFrame
tail(x, ...)
# S4 method for SubtimeDataFrame
show(object)
# S3 method for SubtimeDataFrame
plot(
x, y=NULL, type='p', lty=1:6, lwd=1, pch=1:25, col=NULL,
xlim=NULL, ylim=NULL, log='', main='', sub='', xlab='', ylab='',
ann=par('ann'), axes=TRUE, asp=NA, as.is=TRUE, format=NULL, ...)
# S3 method for SubtimeDataFrame
points(
x, y=NULL, type='p', lty=1:6, lwd=1, pch=1:25, col=NULL, as.is=TRUE, ...)
# S3 method for SubtimeDataFrame
lines(
x, y=NULL, type='l', lty=1:6, lwd=1, pch=1:25, col=NULL, as.is=TRUE, ...)
# S3 method for SubtimeDataFrame
barplot(height, format='', ...)
POSIXst
.
a data.frame with as much rows as needed for the created object. Can
be NULL
(hence the data.frame has zero column and as much rows
as needed).
object to convert to a TimeInstantDataFrame or SubtimeDataFrame object (to modify, to extract or to test)
indicates the subtime part to extract ('year', 'month', 'day', 'hour', 'minute', 'second').
used to specify the main period from wich the is to extract ('year', 'month', 'day', 'hour', 'minute'). Not used for ‘unit in c('year', 'month')’.
function to use for the agregation (if wanted, see ‘details’)
For TimeIntervalDataFrame, it indicates
where the TimeInstant must be taken. If 0
, start
of each intervals is taken as instant ; if 1
end
of each intervals is taken as instant. Any other value
will determine a weigthed instant between start and end
(actually, value higher than 1 or lower than 0 will give
instant outside this range).
indices specifying elements to extract or replace. (See
Extract
)
indices specifying elements to extract or replace. (See
Extract
)
A litteral character string or a name. (See
Extract
)
Used for compatibility with data.frame methods.
New value for the object designated (data.frame, names, row.names, etc.).
SubtimeDataFrame to merge with x
logical; see merge
specifications of the columns used for merging.
logical; if TRUE the resulting merged SubtimeDataFrame is ordered according to 'when' values.
a 'factor' in the sense that ‘as.factor(f)’ defines the
grouping, or a list of such factors in which case their
interaction is used for the grouping. See split
.
a SubtimeDataFrame on which the FUN must be applied.
SubtimeDataFrame object (to modify, to extract or to test)
plotting argument, see plot.default
plotting argument, see plot.default
plotting argument, see plot.default
plotting argument, see plot.default
plotting argument, see plot.default
plotting argument, see plot.default
plotting argument, see plot.default
plotting argument, see plot.default
plotting argument, see plot.default
plotting argument, see plot.default
plotting argument, see plot.default
plotting argument, see plot.default
plotting argument, see plot.default
plotting argument, see plot.default
plotting argument, see plot.default
should data be represented incrementally (the first row is given an x-value of 1, the second of 2, ... the last of n)(TRUE) or should data be grouped by their subtime (all value corresponding to monday are drawn at an x-value of 1) (FALSE) ?
plotting argument, see barplot
for barplot see barplot
,
otherwise a string to format the x-labels according to the format
method of POSIXst objects (see 'Text representation' of POSIXst
).
More arguments.
Formally, the class consists of a data.frame
and, for each row, a POSIXst
(or subtime).
This class is provided to deal with subtime data. This class
is compatible
with TimeIntervalDataFrame
and TimeInstantDataFrame
.
The construction of the class allows to manipulate objects as if they were data.frame (see ‘Access to data’ and ‘Access to data properties’). Several functions are also available to access to time properties (see ‘Access to time properties’).
Methods are also available to facilitate the representations of instances of that class : see ‘graphic representation’ and ‘text representation’.
Finally, some specific methods allow to easily deal with agregation of data over time properties (day, hour, week, special or specific time).
Objects can be created by calls of the form
new("SubtimeDataFrame", ...)
... argument must be replaced
by named arguments coresponding to slots of a SubtimeDataFrame (see below).
See also new
.
SubtimeDataFrame (when, data=NULL, ...)
Arguments of the function correspond to object slots.
as.SubtimeDataFrame (from, representation, cursor=NULL, FUN=mean, ...)
Converting object to SubtimeDataFrame.
Conversion from a TimeIntervalDataFrame to a
SubtimeDataFrame can be direct or after agregation. For a direct conversion (where date are only replaced by
the desired subtime), FUN must be NULL. For an agregateed conversion, the function to use must be
indicated by the FUN arg and all arguments to pass to
this function can be given (namely).
when
:Object of class "POSIXst"
corresponding to the instant of each row of
the data.frame
.
data
:Object of class "data.frame"
data contained
by the object.
The SubtimeDataFrame class is defined to works like the data.frame class
with the difference that a subtime (POSIXst
) is
attached to each rows of the data.frame. Thus to access and manipulate
data of a TimeInstantDataFrame the following methods are defined :
'$', '$<-', '[', '[<-', '[[', '[[<-'. See Extract
for
details.
Other methods have been defined to allow some operations over TimeInstantDataFrame :
merge to join two (or more) SubtimeDataFrame (see
merge
),
a SubtimeDataFrame can be splitted exactly the same way that
a data.frame can (see split
in the base
package),
a function can be applied over each column of a TimeIntervalDataFrame
via the lapply function provided that the function return one value (in
this case the resulting value is a TimeIntervalDataFrame
beginning at the first instant of the object and ending at the latest one),
or as much values as the number of rows of the object (in this case the
SubtimeDataFrame given in argument in returned with the new values
calculated).
Because a SubtimeDataFrame works more or less like a data.frame,
the following methods work on a SubtimeDataFrame :
dim
,
length
,
names
,
names<-
,
ncol
,
nrow
,
row.names
,
row.names<-
.
A SubtimeDataFrame can be tested for a few time properties :
gives or sets the timezone of the SubtimeDataFrame ;
returns a POSIXst object with the time instant of the SubtimeDataFrame.
returns the unit of the time instant of the SubtimeDataFrame.
returns the 'of' of the time instant of the SubtimeDataFrame.
TimeInstantDataFrame
, TimeIntervalDataFrame
,
POSIXst