SCM

SCM Repository

[rmetrics] View of /pkg/timeSeries/R/base-start.R
ViewVC logotype

View of /pkg/timeSeries/R/base-start.R

Parent Directory Parent Directory | Revision Log Revision Log


Revision 4869 - (download) (annotate)
Mon May 17 23:53:15 2010 UTC (8 years, 9 months ago) by chalabi
File size: 1836 byte(s)
updated start/end to handle TZ
#
#  This program is free software; you can redistribute it and/or modify
#  it under the terms of the GNU General Public License as published by
#  the Free Software Foundation; either version 2 of the License, or
#  (at your option) any later version.
#
#  This program is distributed in the hope that it will be useful,
#  but WITHOUT ANY WARRANTY; without even the implied warranty of
#  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
#  GNU General Public License for more details.
#
#  A copy of the GNU General Public License is available at
#  ../../COPYING


################################################################################
# FUNCTION:                 DESCRIPTION:
#  start,timeSeries          Extracts start date of a 'timeSeries' object
#  end,timeSeries            Extracts end date of a 'timeSeries' object
################################################################################


.start.timeSeries <- function(x, ...)
{
    if (length(x@positions)>0)
        timeDate(min(x@positions), zone = "GMT", FinCenter = x@FinCenter)
    else
        NULL
}

setMethod("start" , "timeSeries", function(x, ...) .start.timeSeries(x, ...))

# until UseMethod dispatches S4 methods in 'base' functions
start.timeSeries <- function(x, ...) .start.timeSeries(x, ...)


# ------------------------------------------------------------------------------


.end.timeSeries <- function(x, ...)
{
    if (length(x@positions)>0)
        timeDate(max(x@positions), zone = "GMT", FinCenter = x@FinCenter)
    else
        NULL
}

setMethod("end", "timeSeries", function(x, ...) .end.timeSeries(x, ...))

# until UseMethod dispatches S4 methods in 'base' functions
end.timeSeries <- function(x, ...) .end.timeSeries(x, ...)


################################################################################


R-Forge@R-project.org
ViewVC Help
Powered by ViewVC 1.0.0  
Thanks to:
Vienna University of Economics and Business University of Wisconsin - Madison Powered By FusionForge