clr (version 0.1.0)

clrdata: Create an object of clrdata

Description

clrdata is used to create a clrdata object from raw data inputs.

Usage

clrdata(x, order_by, support_grid)

Arguments

x

A vector containing the time series values

order_by

A corresponding vector of unique time-dates - must be of class 'POSIXct'

support_grid

A vector corresponding to the support grid of functional data

Value

An object of class clrdata with one function a row. As it inherits the matrix class, all matrix methods remain valid.

Examples

Run this code
# NOT RUN {
library(clr)
data(gb_load)

clr_load <- clrdata(x = gb_load$ENGLAND_WALES_DEMAND,
                    order_by = gb_load$TIMESTAMP,
                    support_grid = 1:48)

head(clr_load)
dim(clr_load)
summary(clr_load)

matplot(t(clr_load), ylab = 'Daily loads', type = 'l')
lines(colMeans(clr_load, na.rm = TRUE),
      col = 'black', lwd = 2)


clr_weather <- clrdata(x = gb_load$TEMPERATURE,
                       order_by = gb_load$TIMESTAMP,
                       support_grid = 1:48)
summary(clr_weather)
plot(1:48,
     colMeans(clr_weather, na.rm = TRUE),
     xlab = 'Instant', ylab = 'Mean of temperatures',
     type = 'l', col = 'cornflowerblue')
# }

Run the code above in your browser using DataCamp Workspace