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)

Arguments

x

An S7 class object that extends class_vecvec. Typically the class object created by S7::new_class() in your package, e.g. class_myvec.

Value

NULL, invisibly. Called for its side effects.

Details

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.

Examples

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