rowNames: Row and Column Names of a "datacggm" Object

View source: R/datacggm_tools.R

rowNames + colNamesR Documentation

Row and Column Names of a “datacggm” Object

Description

Retrieve or set the row or column names of a “datacggm” object.

Usage

rowNames(x)
rowNames(x) <- value

colNames(x)
colNames(x) <- value

Arguments

x

an R object of class ‘datacggm’.

value

a named list with elements ‘X’ and ‘Y’.

Details

For an R object of class ‘datacggm’, rowNames (colNames) retrieves or set rownames (colnames) for matrices Y and X. See below for some examples.

Author(s)

Luigi Augugliaro (luigi.augugliaro@unipa.it)

See Also

datacggm, rcggm and the method function dimnames.

Examples

set.seed(123)
# a dataset from a censored Gaussian graphical model
n <- 100L
p <- 3L
Z <- rcggm(n = n, p = p, probl = 0.05, probr = 0.05)

rowNames(Z)
rowNames(Z) <- list(Y = paste0("i", seq_len(n))) 
# the same as rowNames(Z)$Y <- paste0("i", seq_len(n))
rowNames(Z)

colNames(Z)
colNames(Z) <- list(Y = paste("Y", 1:p, sep = ":"))
# the same as colNames(Z)$Y <- paste("Y", 1:p, sep = ":")
colNames(Z)

# a dataset from a  conditional censored Gaussian graphical model
n <- 100L
p <- 3L
q <- 2
b0 <- runif(p)
B <- matrix(runif(q * p), nrow = q, ncol = p)
X <- matrix(rnorm(n * q), nrow = n, ncol = q)
Z <- rcggm(n = n, b0 = b0, X = X, B = B, probl = 0.05, probr = 0.05)

rowNames(Z)$Y <- paste0("i", seq_len(n))
rowNames(Z)$X <- paste0("i", seq_len(n))
dimnames(Z)

colNames(Z)$Y <- paste("Y", 1:p, sep = ":")
colNames(Z)$X <- paste("X", 1:q, sep = ":")
dimnames(Z)

cglasso documentation built on Jan. 17, 2023, 5:10 p.m.