简体   繁体   中英

Reload updated package in R

I used to develop some package for R. So, this is an iterative process where I need to check the working of the package in between by installing it via rstudio, and then again adding some necessary functionalities. So, I used the following process:

  1. create a R package
  2. install it via command prompt: R CMD install <{package_name}>
  3. load the package in rstudio as, library(package_name)
  4. Check the necessary functionality
  5. detach package in rstudio using, detach(package:{package_name})
  6. remove package via command prompt as: R CMD remove <{package_name}>
  7. add/update package
  8. repeat steps 2 - 7,until package is fully developed.

Now the problem is that everytime I close rstudio after step 5, otherwise updated package after installation is not reflected in R. So, How can I avoid to close rstdio everytime; and always get updated copy of installed package. In other words, I don't want to close rstudio everytime. I have found that detach( ) is not effective.
Note: I use rstudio only for checking the functionality of package. I check,build for building packages on command prompt using R CMD check/build commands

RStudio has functionality for building packages that I does what I think you have described.

Basically, use 'new project' and select the R-package option or just open an old project using the '.Rproj' file

Then use the build and reload each time you make a change to the package and want to reload the package in (see pic).

Seems to work OK for me.

Rstudio构建映像

See link for more details: https://support.rstudio.com/hc/en-us/articles/200486488-Developing-Packages-with-RStudio

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM