Kim
Kim

Reputation: 403

R warning: " 'package:stats' may not be available when loading"

I've been working with the arules package and RODBC package for a few days now in RStudio. I saved the workspace image multiple times in the meantime. But today I wanted to save my workspace image again and now I get this warning:

Warning message: In save(list = ls(envir = .GlobalEnv, all.names = TRUE), file = outfile, : 'package:stats' may not be available when loading

I only used arules and RODBC functions and str_split_fixed from stringr and some standard stuff like data.frame.
I didn't even use the stats package at all. When reloading the workspace image, it doesn't seem affected by it. But the warning is bothering me anyway, especially since stats is supposed to be a standard package of R, how can it be unavailable... How can I resolve this warning?

Upvotes: 7

Views: 9662

Answers (2)

Ofek Shilon
Ofek Shilon

Reputation: 16147

This is now an official rstudio bug.

In my case (the repro in the bug) the root cause was that one of the objects I was trying to save referenced an rstudio-internal function (this isn’t very exotic. A plain options call returns a list that does that). RStudio functions live in tools:rstudio namespace, which inherits the stats package among others - hence the warning.

It is currently planned to be fixed as part of v1.4.

Upvotes: 0

Kim
Kim

Reputation: 403

As the commentator didn't post his comment as an answer, I will close this question myself: it's a bug in RStudio and knowing this thanks to SO I could close down RStudio and a couple R programming sessions later the warning message did not occur again.

Upvotes: 4

Related Questions