bfgray3 commented on a change in pull request #8118: [R] various small changes 
for efficiency and robustness in R package
URL: https://github.com/apache/incubator-mxnet/pull/8118#discussion_r150712851
 
 

 ##########
 File path: R-package/R/zzz.R
 ##########
 @@ -16,7 +16,10 @@ NULL
 
 .onLoad <- function(libname, pkgname) {
   # Require methods for older versions of R
-  require(methods)
+  if (! is.element("package:methods", search())) {
 
 Review comment:
   "Since S4 is implemented in the methods package, you need to make sure it?s 
available. This is easy to overlook because while the method package is always 
available in the search path when you?re working interactively, it?s not 
automatically loaded by Rscript, the tool often used to run R from the command 
line." (http://r-pkgs.had.co.nz/namespace.html).  According to this same 
source, the following is best practice for making this package available.  I 
will update the PR with this change.
   
   ```
   #' @import methods
   NULL
   ```

----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on GitHub and use the
URL above to go to the specific comment.
 
For queries about this service, please contact Infrastructure at:
us...@infra.apache.org


With regards,
Apache Git Services

Reply via email to