Create a matrix with integer or character names for rows and columns. Integer
names are useful when dealing with very large numbers of rows or columns, as
the integer names can be stored more efficiently than character names. Whilst
this is possible for data.frames, the native matrix class only allows for
character row and column names via the dimnames attribute. Use
row_names() and col_names() to get or set the integer names, which are
stored in special attributes (int_rownames and int_colnames) on the
matrix.
Details
This class allows you to have integer names as attributes while still being a
matrix, and provides methods for getting and setting these names. When you
create a matrix_int_names object, you can provide integer or character
vectors for row and column names. If you provide integer vectors, they will
be stored in special attributes (int_rownames and int_colnames) instead
of the standard dimnames. If you provide character vectors, they will be
stored in the standard dimnames as usual. You can also mix and match,
having integer names for rows and character names for columns, or vice versa.
Note that, since the row and column names are stored in special attributes,
you have to use row_names() and col_names() to get or set them, rather
than rownames() and colnames(), which will only return character names if
present.
See also
Other matrix_int_names_functions:
[.matrix_int_names(),
as.data.frame.matrix_int_names(),
col_names(),
print.matrix_int_names(),
row_names()
