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

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.


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

Tags:

R

Cran