knitr::opts_chunk$set( collapse = TRUE, comment = "#>" )
There are lots of specific rules around when to run specific commands when you're editing a package. The simplest one to follow is just to do everything -- it is a bit time consuming, but it's simpler! First restart R, then:
devtools::document() devtools::install() library(packagename)
Then if you're sure it's working, stage and commit the changes and push them to github.
If you want to know the specific details of when you actually need to run the individual commands though, here they are...
devtools::document()
?You should call devtools::document()
when you:
Edit a function's documentation block (this edits a file in the man directory)
```r
``` 2. Write a new function with a documentation block (this generates a file in the man directory)
Note that: when you call
?function
the help file is generated from the files in the man directory, but only when the changes are installed and loaded into R.
?packagename
after installing and loading it into R)Note that: the NAMESPACE file lists the functions that will be included in your package on install as well as any external package dependencies.
devtools::install()
?devtools::install
will install all changes to your package (edits to functions, edits to demos, changes to NAMESPACE, and files in the man directory) to your instance of R.
library()
?library()
will load the version of the package currently installed in your
instance of R (it doesn't matter whether you've installed it via
devtools::install()
, devtools::install_github()
, or install.packages()
). You
need to restart R before calling library though, or you will be stuck with the
old version of the package.
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.