I have a package where I have a couple of generic methods. They're all S3 generics with the structure typical of what you'd see in one:
func_one <- function(x, ...) { UseMethod("func_one") }
func_one.data.frame(function(x,...) { dim(x) }
func_one.matrix(function(x, ...) {dim(x) }
In my NAMESPACE file, I have tried exporting only the top function(func_one), but then when I would go to run func_one on a data.frame, or a matrix, it would error out. I then went ahead and added func_one.data.frame AND func_one.matrix in the NAMESPACE, but this still didn't do anything.
Just to be clear, these generic methods would FIND in R, but just not as a package. Any help would be great. :)
Here's the namespace file:
S3method(func_one,data.frame)
S3method(func_one,matrix)
S3method(func_one,tbl_df)
export(func_one)
Here's an example of the actual function file (func.R)
#' @export
func_one <- function(data, ...) {
UseMethod("func_one")
}
#' @export
func_one.data.frame <- function(data, ...) {
dim(x)
}
#' @export
func_one.matrix <- function(data, ...) {
dim(x)
}
Then after I install the R package within R, and try using it, I get a UseMethod error.