How can I prevent a library from masking functions

前端 未结 5 1047
一个人的身影
一个人的身影 2021-02-04 06:21

A typical situation is the following:

library(dplyr)
library(xgboost)

When I import the library xgboost, the function slice<

5条回答
  •  误落风尘
    2021-02-04 06:46

    1. It is possible to prevent some functions from being masked?

    I don't believe so but I could be wrong. I'm not sure what this would look like

    1. Is it possible to mask "the masking function" (e.g. xgboost::slice) with an early imported function (e.g. dplyr::slice)?

    If you're asking about just or use in an interactive session you can always just define slice to be the function you actually want to use like so

    slice <- dplyr::slice
    

    and then you can use slice as if it is the dplyr version (because now it is).

提交回复
热议问题