How to use S3 methods from another package which uses export rather than S3method in its namespace without using Depends or library() How to use S3 methods from another package which uses export rather than S3method in its namespace without using Depends or library() r r

How to use S3 methods from another package which uses export rather than S3method in its namespace without using Depends or library()


The key here is to import the specific methods in addition to the generic you want to use. Here is how you can get it to work for the default method.

Note: this assumes that the test.h5 file already exists.

#' @importFrom rhdf5 h5write.default#' @importFrom rhdf5 h5write#' @exportmyFun <- function(){    h5write(1:4, "test.h5", "test")}

I also have put up my own small package demonstrating this here.