Closed pepijn-devries closed 10 months ago
I see
$ grep as.data.frame NAMESPACE
S3method(as.data.frame,dimensions)
S3method(as.data.frame,stars)
S3method(as.data.frame,stars_proxy)
Thanks for the quick response. Yes, I did see those, but those statements do not export the specific functions. Apparently, it's a bit of a hassle to get s3 methods of other packages into a different namespace.
I ended up using https://vctrs.r-lib.org/reference/s3_register.html and added this to my code:
.onLoad <- function(...) {
s3_register("stars::as.data.frame", "stars")
}
That seemed to have done the trick...
Nope, I was too quick with my response. The code above won't build. Again, because as.data.frame.stars
is not exported from stars. I did get it working by preceding the call to as.data.frame
with:
requireNamespace("stars", quietly = TRUE)
Sometimes the solution can be so easy 😄 /
Hi,
Thanks for all your work on this great package.
Many of the stars S3 methods are not exported in the NAMESPACE file. Consequently, when I'm developing a package that imports from
stars
, and call a generic likeas.data.frame
on astars
object, I get:Alternatively, importing the s3 method
as.data.frame.stars
or callingstars:::as.data.frame.stars
won't work either as these function are not exported bystars
. I guess my issue is related to issues https://github.com/r-spatial/stars/issues/504 and https://github.com/r-spatial/stars/issues/622. The difference is that I can't load the package withlibrary
when developing a package.Is it possible to export these functions, or is there a reason not to?
Thanks for considering.