| [.matrix_int_names | R Documentation |
Subsetting method for matrix_int_names
Assignment method for matrix_int_names
## S3 method for class 'matrix_int_names'
x[i, j, i_names = NULL, j_names = NULL, drop = TRUE]
## S3 replacement method for class 'matrix_int_names'
x[i, j, i_names = NULL, j_names = NULL] <- value
x |
A matrix_int_names object |
i |
Row indices (numeric), row names (character), or missing) |
j |
Column indices (numeric), column names (character), or missing) |
i_names |
Optional integer row names to subset by |
j_names |
Optional integer column names to subset by |
drop |
Logical indicating whether to drop dimensions |
value |
A value to assign to the subsetted matrix |
A subsetted matrix_int_names object
Other matrix_int_names_functions:
as.data.frame.matrix_int_names(),
col_names(),
matrix_int_names(),
print.matrix_int_names(),
row_names()
my_mat <- matrix_int_names(matrix(1:6, nrow = 2),
row_names = c(10L, 20L),
col_names = c(100L, 200L, 300L)
)
# subset by position
my_mat[1, 2:3, drop = FALSE]
# subset by integer names
my_mat[i_names = 20L, j_names = c(100L, 300L), drop = FALSE]
# assign by integer names
my_mat[i_names = 10L, j_names = 200L] <- 0L
my_mat
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.