matrixToCfd: Convert a matrix to a cfda data.frame

View source: R/pretreatment.R

matrixToCfdR Documentation

Convert a matrix to a cfda data.frame

Description

Convert a matrix to a cfda data.frame

Usage

matrixToCfd(X, times = NULL, labels = NULL, byrow = FALSE)

Arguments

X

matrix containing the states

times

time values. If NULL, it uses a sequence of integers starting with 1

labels

id labels. If NULL, it uses the matrix colnames

byrow

if FALSE, one column = one trajectory

Value

a data.frame in the cfda format

See Also

Other format: convertToCfd(), cut_data(), remove_duplicated_states()

Examples

x <- matrix(
  c(
    "a", "b", "c", "c",
    "c", "a", "a", "a",
    "b", "c", "a", "b"
  ),
  ncol = 4, byrow = TRUE,
  dimnames = list(NULL, paste0("ind", 1:4))
)
matrixToCfd(x)

cfda documentation built on April 3, 2025, 9:21 p.m.