The goal of repositoryr is to provide a step by step guide to creating a R package repository.
RStudio installed: You will need R and RStudio both installed. You can do so either by:
choco install r.project
and then RStudio using
choco install r.studio
) ORInstall the package available
in RStudio using
install.packages("available")
. To find suggestions on valid package
names use
available::suggest(text="description of what the package does")
. You
can also check whether the package name is available using
available::available("pkgname")
.
Alternatively, you can use
pak::pkg_name_check("healthgpsrvis", dictionaries = NULL)
. (Note: To
install pak
, use install.packages("pak")
).
More details: Create and connect a GitHub repo
origin
and click “Add”.git remote add origin https://github.com/ImperialCollegeLondon/repositoryr
git push --set-upstream origin main
devtools
install.packages("devtools")
.usethis
package too).devtools::check()
devtools::check()
to see if there are any
issues with the package.DESCRIPTION
file. It will be fixed soon!DESCRIPTION
fileDESCRIPTION
file contains the metadata of your package. You can
add some descriptive text about your package under Title
and
Description
fields. You can also fill in the author and maintainer
details.DESCRIPTION
file.devtools::check()
to verify if everything works (As of now, it
raises a note “Licence stub is invalid DCF.”)usethis::use_r("filename")
.filename.R
file will be created under the R/
directory which you
can populate.usethis::use_test("filename")
.test-filename.R
file will be created under the tests/testthat/
directory where you can add the unit tests.devtools::document
to set up the documentation for your package.R/hello.R
file.R/add.R
file).Code > Insert roxygen skeleton
. A comment structure should appear
above your function, in which each line begins with #’.NAMESPACE
file already exists,
please delete it so that it can be automatically generated by
roxygen2
. To do so, run devtools::document()
this will also create
the corresponding filename.Rd
file in man/filename.Rd
using
roxygen2
.usethis::use_readme_rmd()
to initialize a basic, executable
README.Rmd
file.README.Rmd
you can add the purpose of the package, provide
installation instructions, and show an example of how the package can
be used.README.Rmd
file to make the README.md
file.
You can do this by running devtools::build_readme()
.install.packages("pkgdown")
.usethis::use_pkgdown_github_pages()
.pkgdown::build_site()
.README.md
becomes the homepage, documentation in man/
generates a function reference, and vignettes will be rendered into
articles/
.You can install the development version of repositoryr from GitHub with:
# install.packages("pak")
pak::pak("ImperialCollegeLondon/repositoryr")