Warning: replacing previous import ‘head’ when loading ‘utils’ in R

前端 未结 2 905
南笙
南笙 2020-12-10 12:00

When loading the RTextTools package from CRAN, I get the following warnings:

Warning messages:
1: replacing previous import ‘head’ when loading

相关标签:
2条回答
  • 2020-12-10 12:16

    In general, this problem is often caused by having import(somepackage) in the namespace as well as importFrom(somepackage, somefunction).

    Equivalently, using roxgyen2, having both #' @import somepackage and #' @importFrom somepackage somefunction.

    The best practice solution is to remove the import statement ans keep only importFrom.

    0 讨论(0)
  • 2020-12-10 12:26

    This is not your issue - it's an issue in the glmnet package that you depend on: it explicitly imports all functions from both Matrix and utils but in the wrong order which causes a conflict since they both define head and tail (Matrix depends on utils so utils must be first). It is easy to fix - the order of imports has to be reversed in the glmnet/NAMESPACE but only the maintainer of glmnet can do that.

    PS: This would be better asked on R-devel

    0 讨论(0)
提交回复
热议问题