Learn R Programming

dad (version 4.1.6)

as.foldert.array: Data frame to foldert

Description

Builds an object of class foldert from a \(3d\)-array.

Usage

# S3 method for array
as.foldert(x, ind = 1, var = 2, time = 3, ...)

Value

an object ft of class foldert that is a list of data frames, each of them corresponding to a time of observation; these data frames have the same column names.

They necessarily have the same row names (attr(ft, "same.rows")=TRUE). The "times" attribute of ft: attr(ft, "times") is a numeric vector, an ordered factor or an object of class Date, and contains the values nf the dimension of x given by time argument.

Arguments

x

a \(3d\)-array.

ind, var, time

three distinct integers among 1, 2 and 3.

ind gives the dimension of the observations, var gives the dimension of the variables and ind gives the dimension of the times.

...

further arguments passed to or from other methods.

Author

Rachid Boumaza, Pierre Santagostini, Smail Yousfi, Gilles Hunault, Sabine Demotes-Mainard

See Also

foldert: objects of class foldert.

as.foldert.data.frame: build an object of class foldert from a data frame.

Examples

Run this code
x <- array(c(rep(0, 5), rep(0, 5), rep(0, 5),
             rnorm(5, 2, 1), rnorm(5, 3, 2), rnorm(5, -2, 0.5),
             rnorm(5, 4, 1), rnorm(5, 5, 3), rnorm(5, -3, 1)),
           dim = c(5, 3, 3),
           dimnames = list(1:5, c("z1", "z2", "z3"), c("t1", "t2", "t3")))
# The individuals which were observed are on the 1st dimension,
# the variables are on the 2nd dimension and the times are on the 3rd dimension.
ft <- as.foldert(x, ind = 1, var = 2, time = 3)

Run the code above in your browser using DataLab