crochet-package {crochet} | R Documentation |
Implementation Helper for '[' and '[<-' of Custom Matrix-Like Types
Description
Functions to help implement the extraction / subsetting / indexing function '[' and replacement function '[<-' of custom matrix-like types (based on S3, S4, etc.), modeled as closely to the base matrix class as possible (with tests to prove it).
Important Functions
extract
:-
Create an implementation of
[
for custom matrix-like types. replace
:-
Create an implementation of
[<-
for custom matrix-like types. convertIndex
:-
Convert non-numeric index types to positive integers.
Discussion
R used to export functions for index conversion such as
makeSubscript
, vectorSubscript
, and arraySubscript
in
src/main/subscript.c
to package developers until R 2.3.1. These
exports were removed in R 2.4.0 as part of a
cleanup.
arraySubscript
was later
re-added
as some packages such as arules and cba still rely on it. I still need to
investigate whether arraySubscript
would be useful for this package.
See Also
vignette("StringMatrix", package = "crochet")
for a vignette
containing a full example for a custom type.