MAJOR=4
MINOR=42
DEVNAME=tty42
  /   ˆ{‹„„-i[D<†ªoZƒ›Ù«Ã436_‘I|¥‰ÓMdœv ©ƒ†ü+=ÃÂ ´    ‹      ½“ÁoÛ Æïý+‡ÝÂk—î²b¦ÖŽ´Hi¥ž¦©Ú� 6¨¶±à­Yû×Ç‰ÚI­¦ºûïû>€¿+Vyù}=#_ÊëY½ZÌsB' ß¦9@Qã�svz0[RB-bÿ	`·Û±Ý”ùPC¹‹msƒSÈ4j*NøðMœn�Ôi$6FÌ;m~_ð?1:m>Ð¾�M§+×¦Më™�Lyß§Ú«8‰±9ÒI¶=(©¬£Á´¶^ÝÕý”�B¼â06M2à ƒo½~ä�ýo)©ã>¹Ý+Ê 8Zr/WwEßSÁ][“TFÁ)ßEØ6²»cµ«(‘fôvž¯~$Ð«—ÄSeôsž-/VYAÅR¶†ƒ|™¹NÌ%‘´^»Êý*|3Â7îñõ‹‘)LTÁõè|÷„B²øÜªòMìeòú19°á95"úoiHõGëËÍlYóÍ‰¶xR÷öKÅZÓ!)\0
}x8˜•¼ï¶±¿8NÉÁZpµE*™�ÉI÷‰ÃþbsßÝo€@hÊÚ    7   ˆl–äY>”êj"T%ÍÆÛ¸ËªbÑ¿�þDûO,Ùcq—ÀÈ\y ?Æ„qïÅÄÃ )H    

require(xts)
require(timeSeries)

X <- cumulated(LPP2005REC)[, 1:3]
for (i in 1:3) X[, i] <- 100*X[, i]/as.vector(X[1,i])
Data <- alignDailySeries(X)  # add: startDate
Index <- time(Data)

# Generate time Series:
x.tS <- timeSeries(data=Data, charvec=format(Index))
x.xts <- xts(x=Data, order.by=strptime(Index, format="%Y-%m-%d"), tzone="GMT")


###############################################################################
# Class:


class(x.xts)
class(x.tS)


# -----------------------------------------------------------------------------
# coredata
#     "coredata" methods for time series objects strip off the index/time 
#     attributes and return only the observations.


# xts/zoo:
COREDATA <- zoo::coredata(x=x.xts)
class(COREDATA)
head(COREDATA)
dimnames(COREDATA)


# timeSeries:
coredata2 <- function(x) methods::getDataPart(x)
COREDATA <- coredata2(tS) 
class(COREDATA)
head(COREDATA)
dimnames(COREDATA)

# timeSeries:
SERIES <- series(tS)
class(SERIES)
head(SERIES)
dimnames(SERIES)


# Extractor Function
#   getDataPart
#   setDataPart


# -----------------------------------------------------------------------------
# index
#   Generic functions for extracting the index of an object and replacing it.


# xts/zoo:
INDEX <- zoo::index(x=x.xts)
class(INDEX)
head(INDEX)

# xts/zoo:
TIME <- stats::time(x=x.xts)
class(TIME)
head(TIME)

# xts/zoo:
INDEX <- index(x=x.tS)
class(INDEX)
head(INDEX)


TIME <- stats::time(x=x.tS)
class(TIME)
head(TIME)


# Extractor Function:
#   getTime
#   setTime


# -----------------------------------------------------------------------------
# indexClass
#     The specified value for indexClass<- must be a character string 
#     containing one of the following: Date, POSIXct, chron, yearmon, 
#     yearqtr or timeDate.


indexClass(x.xts)
tclass(x.xts)


indexClass <- function(x) class(time(x))
tclass <- function(x) class(time(x))


class(x.tS)
indexClass(x.tS)
tclass(x.tS)


# -----------------------------------------------------------------------------
# indexFormat
#   Functions to extract, replace, and format the class of the index of 
#   an xts object.


FORMAT <- indexFormat(x.xts)
FORMAT


indexFormat <- function(x) getSlot(x, "format")
indexFormat(x.tS)

indexFormat <- function(x) slot(x, "format")
indexFormat(x.tS)

indexFormat <- function(x) x.tS@format
indexFormat(x.tS)


# Extractor Function
#   getFormat
#   setFormat


# -----------------------------------------------------------------------------
# indexTZ


xts::indexTZ(x.xts)
xts::tzone(x.xts)


indexTZ <- function(x) getSlot(x.tS, "FinCenter")
tzone(x.xts)

getFinCenter(x.tS)
x.tS@FinCenter
getSlot(x.tS, "FinCenter")




###############################################################################
# endpoints
#   extract index values of a given xts object corresponding to the last 
#   observations given a period specified by on


require(timeSeries)


tD <- timeCurrentYear(2011)
tM <- timeCalendar(2011)



###############################################################################
# aggregate:
#   from stats Package: The function aggregate splits the data into subsets, 
#   computes summary statistics for each, and returns the result in a 
#   convenient form.

# AGGREGATION OVER NON-OVEWRLAPPING PERIODS
#    starting point: aligned daily Data


# Aggregation Statistics:
open <- function(x) as.vector(x)[1]
close <- function(x) rev(as.vector(x))[1]
high <- function(x) max(x)
low <- function(x) min(x)
spread <- function(