View source: R/datacggm_tools.R
rowNames + colNames | R Documentation |
Retrieve or set the row or column names of a “datacggm” object.
rowNames(x) rowNames(x) <- value colNames(x) colNames(x) <- value
x |
an R object of class ‘ |
value |
a named list with elements ‘ |
For an R object of class ‘datacggm
’, rowNames
(colNames
) retrieves or set rownames
(colnames
) for matrices Y
and X
. See below for some examples.
Luigi Augugliaro (luigi.augugliaro@unipa.it)
datacggm
, rcggm
and the method function dimnames
.
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)
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.