We'll need more information to help you figure out what's going wrong.
- Does it only happen when you close and reopen RStudio? Or does it also happen when you restart your R session within RStudio (Ctrl+Shift+F10)?
- What do you mean by "rebuild?" Do you mean the "install and restart" task in RStudio (Ctrl+Shift+B)? Do you mean
devtools::build() and then installing it yourself with install.packages? Or something else?
- Is there anything special about your computer setup that may affect this? Are your R libraries stored on your computer, on a shared drive, or in the cloud? You can see where they are with
.libPaths().
In the meantime, you can find out more about what's happening. After rebuilding the package, run this:
ip <- installed.packages()
ip["mypackage", "LibPath"] # Replace "mypackage" with your package's name
That will show the directory where your package was installed. Make a note of it, then close and reopen RStudio. Now run this:
.libPaths()
If the directory you noted before is not shown, then something weird is happening. Without knowing more, I really cannot say what.
If the directory is shown, then something very weird is happening.
P.S.: Your English is easy to understand, so no worries.