When I load my package into the global environment, I get the following message
> library(saber)
Attaching package: ‘saber’
The following objects are ma
There's a third implied question that I don't think has been fully answered for this particular case. How to fix it in the situation where an earlier version of your own function is stuck in the global environment and masking new versions you're trying to test?
Renaming your function with every rev is not practical in this situation. I had the same situation and found deleting the .Rdata file in the working directory before restarting R solved the problem.
This has happened to me only twice over hundreds of time assembling my packages. I'm still not sure how the functions are occasionally getting stuck in global.
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,
saber::teamStats
.Probably (2) is best, unless the circumstances that led to the message are truly unusual.
The reason is you used the above two variable as local variable in your Rconsole. Since it is global variable you need to clean your existing project if not necessary else rename the local variable
In my case:
I declared a time series as gas. Later During calling forecast package i encountered same error and i renamed the library and used the package
The answers above give the low-level causes.
I just thought it would be useful to point out I got that message when I had a project open in RStudio and I loaded the "same" library of that project.
With the explanations above its obvious doing this creates some kind of conflict.
This means that you have objects named load.schedule
, teamStats
in your workspace as well as in the library you are loading. It is warning you that when you call load.schedule
it will use the one in your workspace (since it is first in the search path) rather than the one you are attaching. Try for example
ddply <- function(x) x + 1
library(plyr)
# Attaching package: ‘plyr’
#
# The following object is masked _by_ ‘.GlobalEnv’:
#
# ddply
ddply(3) # the one we just defined is used, as global env is first in the search path
#[1] 4