简体   繁体   中英

R package development - old version of function used in project

I am developing a package locally with devtools in RStudio. After modifying a function, when I try to call it from a project, R keeps using the old version of the function.

My workflow is to:

  • Modify the function and save
  • Call Build & Reload
  • Test the function with some example code in the package development project (I often run another Build & Reload after that)
  • Go to the project I want to use the function in
  • call library(my_library)

But the modification I just did would not be effective. What is wrong with this workflow?

?devtools::build :

Building converts a package source directory into a single bundled file. If binary = FALSE this creates a tar.gz package that can be installed on any platform, provided they have a full development environment (although packages without source code can typically be install out of the box). If binary = TRUE, the package will have a platform specific extension (eg .zip for windows), and will only be installable on the current platform, but no development environment is needed.

My reading of this is that you still need to devtools::install() your package. Building just creates the binary, it doesn't install the new version.

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