R `as` method for converting custom S4 class

Viewed 87

I'm developing an R package and want to include a function that overrides igraph::as.igraph() and lets users convert my custom class into an igraph::igraph object. What's the correct way to do this?

1 Answers

Import the generic from the igraph package, and export your method for your class.

#' @importFrom igraph as.igraph
NULL

#' @export
as.igraph.yourclass <- function(x, ...)
{
    your code here
}

Related