
Datasets can be stored in different formats.
General format for regular and irregular data. One long matrix with curve-ID in first column, curve evaluations in second and time points in third column.
Format for regular data only. Matrix of dimension nr_time x nr_curves.
Format for regular and irregular datasets. List of three
matrices, all with same dimension.
One evaluation matrix Yin
where curves are stored
in rows. One matrix of time points Tin
. One incidence matrix isobs
with entry 1, if curve has evaluation at this time point.
# S4 method for list,character
formatFuncy(data, format="Format1", regTime=NULL)
# S4 method for matrix,character
formatFuncy(data, format="Format1", regTime=NULL)
Data in format "Format1"
, "Format2"
or "Format3"
.
Format to transform data to. One of "Format1"
or "Format3"
.
"Format2"
is possible only if dataset in data
is regular.
Optional vector of time points if original data is in "Format2"
.
Numeric matrix if format
="Format1"
or
format
="Format2"
. If format
="Format3"
, a
list of the three matrices Yin
, Tin
, isobs
and
two vectors N
and t_all
. N
stores the number of
time points for each curve and t_all
is a vector of unique
time points (see Arguments
).
Data, especially for irregular time points is often stored in different
ways. To switch back and forth between data formats, formatFuncy can
be used. For regular datasets in format "Format2"
, an optional
vector of evaluation time points can be given as
regTime
.
Christina Yassouridis and Dominik Ernst and Friedrich Leisch. Generalization, Combination and Extension of Functional Clustering Algorithms: The R Package funcy. Journal of Statistical Software. 85 (9). 1--25. 2018
# NOT RUN {
##Generate regular dataset
set.seed(2005)
ds <- sampleFuncy(obsNr=100, k=6, timeNr=20, reg=TRUE)
Data(ds)
##Format dataset to Format1
newdat <-formatFuncy(data=Data(ds), format="Format1")
newdat
##Back to matrix out of Format1
formatFuncy(newdat, format="Format2")
##To Format3
formatFuncy(newdat, format="Format3")
##Generate irregular dataset
set.seed(2005)
ds <- sampleFuncy(obsNr=100, k=5, timeNrMin=5, timeNrMax=10, reg=FALSE)
res <- formatFuncy(Data(ds), format="Format3", reg=FALSE)
res
##Back to Format1
formatFuncy(data=res, format="Format1", reg=FALSE)
# }
Run the code above in your browser using DataLab