-
Notifications
You must be signed in to change notification settings - Fork 37
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
rstudioapi::restartSession() doesn't unload packages #111
Comments
I've just reproduced this in the current R release. I think this is an important issue because the misconception that this creates a completely fresh session could lead to unexpected reproducibility failures. Edit: I've just discovered that
This is completely unexpected to me, to the point where I am no longer sure what the usecase of this function is. Is this function named in a misleading way? > sessionInfo()
R version 3.5.2 (2018-12-20)
Platform: x86_64-pc-linux-gnu (64-bit)
Running under: Debian GNU/Linux 9 (stretch)
Matrix products: default
BLAS: /usr/lib/openblas-base/libblas.so.3
LAPACK: /usr/lib/libopenblasp-r0.2.19.so
locale:
[1] LC_CTYPE=en_AU.UTF-8 LC_NUMERIC=C LC_TIME=en_AU.UTF-8
[4] LC_COLLATE=en_AU.UTF-8 LC_MONETARY=en_AU.UTF-8 LC_MESSAGES=en_AU.UTF-8
[7] LC_PAPER=en_AU.UTF-8 LC_NAME=C LC_ADDRESS=C
[10] LC_TELEPHONE=C LC_MEASUREMENT=en_AU.UTF-8 LC_IDENTIFICATION=C
attached base packages:
[1] stats graphics grDevices utils datasets methods base
other attached packages:
[1] rstudioapi_0.9.0
loaded via a namespace (and not attached):
[1] compiler_3.5.2 tools_3.5.2 packrat_0.5.0 |
As of RStudio 2024.09.0 & rstudioapi 0.16.0 (my versions, probably earlier), library(dplyr)
select(data.frame(x=1,y=1), y)
## y
## 1 1
rstudioapi::restartSession()
## Restarting R session...
select(data.frame(x=1,y=1), y)
## y
## 1 1
rstudioapi::restartSession(clean = TRUE)
## Restarting R session...
select(data.frame(x=1,y=1), y)
## Error in select(data.frame(x = 1, y = 1), y) :
## could not find function "select" |
Thanks for confirming! |
I just noticed that when I call
rstudioapi::restartSession()
in the console, the packages I had loaded previously are still there. This differs from the behavior of clicking onSession > Restart R
, which doesn't have the following issue.I inputted the commands below, expecting R to throw an error when
select
was called for the second time, but it did not and worked the same both times.Additionally, after restarting the session, the follow message appeared:
I'm using R version 3.3.1 (2016-06-21) and RStudio v. 1.1.456
The text was updated successfully, but these errors were encountered: