`methods` not loaded/working when using lubridate::object notation in Rscript #407
Comments
|
Its how rscript works and there's little to do with lubridate. Either explicitly attach methods in your script or make a pull request that is adding method in the import of the description file ~ I guess. |
infotroph
added a commit
to infotroph/lubridate
that referenced
this issue
Oct 4, 2017
infotroph
added a commit
to infotroph/lubridate
that referenced
this issue
Oct 6, 2017
infotroph
added a commit
to infotroph/lubridate
that referenced
this issue
Oct 6, 2017
infotroph
added a commit
to infotroph/lubridate
that referenced
this issue
Oct 6, 2017
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
I'm having some trouble executing functions that rely on package methods when being run via Rscript. I already know that methods is not attached via Rscript, but it should be loaded (and usable) by the dependent packages and accessible via their package namespaces, at least I thought so...
Example R script (executed via
Rscript
):Output, with my comments and questions mixed below ...
First, here's the startup
sessionInfo()
:As expected with
Rscript
, package methods is not attached, nor loaded.Now, what's surprising to me is that I thought the
lubridate::days(30)
call would load methods, since the lubridate package does "Depend" on methods, as verified in lubridate'sDESCRIPTION
file. Instead, I get the error:But now I'm really confused, because methods does seem to have been loaded, as seen with the next
sessionInfo()
call:Just to be sure (about my confusion), let's try calling
lubridate::days(30)
again:Same error.
OK, now let's explicitly attach methods and try the
lubridate::days(30)
call again:That worked!
What changed by specifically attaching methods?:
methods is not attached (as opposed to loaded-but-not-attached).
I know I could solve all the headaches by simply including
library(methods)
atop scripts, but this seems silly, as I thought loading methods would have the same affect to the underlying packages (due to R's package namespacing), without me having to know specifically if any package I use relies on methods or not.Does this seem like an R problem, or possibly a namespace issue with lubridate?
The text was updated successfully, but these errors were encountered: