Call vecvec_register() inside your package's .onLoad() function to
register the S3 methods that allow a custom
vecvec subclass to participate in the
vctrs vector system.
vecvec_register(
x,
f_ptype2 = vec_ptype2_vecvec,
f_cast_to = vec_cast_to_vecvec,
f_cast_from = vec_cast_from_vecvec
)An S7 class object that extends class_vecvec. Typically the
class object created by S7::new_class() in your package, e.g.
class_myvec.
The function to register as the vec_ptype2 method for this
class. Defaults to vec_ptype2_vecvec, guarantees that the common type of
two vectors is a vecvec vector.
The function to register as the vec_cast.<class>.* methods
for this class. Defaults to vec_cast_to_vecvec, which attempts to cast
other types to vecvec by calling vecvec().
The function to register as the vec_cast.*.<class>
methods for this class. Defaults to vec_cast_from_vecvec, which attempts
to cast vecvec to other types by calling unvecvec().
NULL, invisibly. Called for its side effects.
Specifically, vecvec_register() registers:
vec_cast.<class>.* methods, so that other types can be cast to your
vecvec subclass.
vec_cast.*.<class> methods, so that your vecvec subclass can be cast
from other types.
if (FALSE) { # \dontrun{
# In your package, define a vecvec subclass:
class_myvec <- S7::new_class(
"myvec",
parent = vecvec::class_vecvec
)
# Then register it in .onLoad():
.onLoad <- function(libname, pkgname) {
S7::methods_register()
vecvec::vecvec_register(class_myvec)
}
} # }