I am working on a package that provides custom date S3 classes. I want to export methods for lubridate users, such as year.mydate() and month.mydate(), but I do not want lubridate as a dependency of my package (just a "Suggests". Is this at all possible or do I have to give up on that idea?
Thanks for the Answer, I know about requireNamespace(), but this is not what I am asking about.
I want to provide an S3 method --- let's say year.mydate() for lubridate::year() --- without having to import lubridate::year() from the lubridate NAMESPACE.
One option would be to define my own year() generic, but then I would get conflict warning when the user tries to load my package as well as lubridate, which I also want to avoid.
(For this special case it is enough if I define a as.POSIXlt() method for mydate(), but I was wondering if this is possible in general for S3 classes)