subset: Subsetting method for matrix_int_names

[.matrix_int_namesR Documentation

Subsetting method for matrix_int_names

Description

Subsetting method for matrix_int_names

Assignment method for matrix_int_names

Usage

## 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

Arguments

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

Value

A subsetted matrix_int_names object

See Also

Other matrix_int_names_functions: as.data.frame.matrix_int_names(), col_names(), matrix_int_names(), print.matrix_int_names(), row_names()

Examples

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

tidypopgen documentation built on Nov. 28, 2026, 1:07 a.m.