Implementation in Julia
TimeSeries is a registered package. So like other packages, we can add it to your Julia packages:
Pkg.update()
Pkg.add("TimeSeries")
The TimeArray time series type
immutable TimeArray{T, N, D<:TimeType, A<:AbstractArray} <: AbstractTimeSeries
timestamp::Vector{D}
values::A
colnames::Vector{UTF8String}
meta::Any
function TimeArray(timestamp::Vector{D},
values::AbstractArray{T,N},
colnames::Vector{UTF8String},
meta::Any)
nrow, ncol = size(values, 1), size(values, 2)
nrow != size(timestamp, 1) ? error("values must match length of
timestamp"):
ncol != size(colnames,1) ? error("column names must match width of
array"):
timestamp != unique(timestamp) ? error("there are duplicate dates"):
~(flipdim(timestamp, 1) == sort(timestamp) || timestamp ==
sort(timestamp)) ? error("dates are mangled"):
flipdim(timestamp, 1) == sort(timestamp) ?
new(flipdim(timestamp, 1), flipdim(values, 1), colnames, meta...