Reputation: 19005
I have created a package for personal use that has some dependencies:
Depends: R (>= 3.2.3), data.table (>= 1.9.6), bit64 (>= 0.9.5),
ggplot2 (>= 2.0.0), yaml (>= 2.1.13)
When I install this package via devtools::install()
it completes with no error.
When I load the package in a fresh session via library(somePackage)
I get the cryptic message:
Attaching package: ‘data.table’
The following object is masked by ‘.GlobalEnv’:
.N
There are no objects in the global environment -- I try ls()
, which returns an empty string, clear workspace [broom icon], etc. Yet:
> .N
[1] 100419
which has no meaning to me -- I know what .N
is in data.table but have no idea where 100419 came from. How can I tell which environment in the search path this is really going to?
> search()
[1] ".GlobalEnv" "package:somePackage" "package:devtools" "package:yaml"
[5] "package:ggplot2" "package:bit64" "package:bit" "package:data.table"
[9] "tools:rstudio" "package:stats" "package:graphics" "package:grDevices"
[13] "package:utils" "package:datasets" "package:methods" "Autoloads"
[17] "package:base"
I believe that the dependencies are part of the cause, because when I remove this line from the DESCRIPTION file, I do not have this problem.
Running devtools
1.10.0
on R 3.2.3
for Windows.
update: thanks to the hint from @MrFlick:
> ls(all.names=TRUE)
[1] ".N" ".Random.seed"
So it is in the global environment, but how did it get there and why does it take precedence?
Upvotes: 4
Views: 502
Reputation: 4290
I had the same message when loading data.table
. No idea when I loaded .N
so I went for the following:
Checking all variables to see what I have:
ls(all.names=TRUE)
Removing all varaibles:
rm(list = ls(all.names=TRUE))
Upvotes: 1