Meaning of objects being masked by the global environment

后端 未结 5 1149
广开言路
广开言路 2020-12-05 13:44

When I load my package into the global environment, I get the following message

> library(saber)

Attaching package: ‘saber’

The following objects are ma         


        
5条回答
  •  不知归路
    2020-12-05 14:21

    It means that you have objects (functions, usually) present in your global environment with the same name as (exported) things in your package. Type search() to see the order in which R resolves names.

    The solution is to either,

    1. don't create objects with those names in your global environment
    2. rename the objects in your package to something that's less likely to create a conflict, or rethink your decision to export them, or
    3. remember that you will always have to refer to those objects as saber::teamStats.

    Probably (2) is best, unless the circumstances that led to the message are truly unusual.

提交回复
热议问题