its (version 1.0.3)

itsJoin: Join Functions for Irregular Time-Series Objects

Description

Join functions for objects of class "its".

Usage

union(x,y)
intersect(x,y)
alignedIts(obj1,obj2,print=FALSE)
appendIts(obj1,obj2,but=TRUE,matchnames=TRUE)
collapseIts(x)

Arguments

x, y
an object of class "its" or NULL
obj1,obj2
object of class "its"
print
logical flag to display summary information
but
logical flag controls whether overlap is disallowed
matchnames
logical flag controls whether names must match

Value

  • For union, intersect, appendIts an object of class "its". For alignedIts, a list of two objects of class "its"

Details

union has a number of time values (rows) which is determined by the union of the time-stamps of the two inputs. The number of columns is the sum of the number of columns of the two inputs. intersect has a number of time values (rows) which is determined by the intersect of the time-stamps of the two inputs. The number of columns is the sum of the number of columns of the two inputs. alignedIts selects the rows from two inputs which have identical time-stamps. appendIts appends one object to the other, removing overlapping data from the later object, optionally checking that the column names match. Overlapping data must match. collapseIts checks for columns with the same names, using dimnames(x)[[2]]. columns with the same names are required to have the same numeric values in each row, but are allowed NAs. The numeric data is combined, and the resulting object has unique column names - this will in general result in a reduction in the number of columns.

See Also

ts, POSIXct, itsFile, itsLags, itsJoin, itsTimes, itsSubset, itsFin, itsDisp, itsInfo, itsCumdif, itsArith itsInterp

Examples

Run this code
its.format("%Y-%m-%d")
b <- newIts(1:30,ncol=3,start="2003-01-01",end="2003-01-10")
union(b,diff(b))
intersect(b,diff(b))
alignedIts(b,diff(b))
b1 <- newIts(1:30,ncol=3,start="2003-01-11",end="2003-01-20")
appendIts(b,b1)
c <- union(b,b*NA)
c[2,4] <- 99
c[2,1] <- NA
print(c)
collapseIts(c)

Run the code above in your browser using DataLab