The goal of test is to provide functions that are useful for the creation of an R package.
You can install the development version of test from GitHub with:
# install.packages("devtools")
devtools::install_github("Karim-Mane/test")
library(test)
The createPackage() function is used to create an R project and link it to a remote GitHub account and perform the first commit to that account. The function requires the following parameters:
package.name
: the name of the package/project to be createdwhere
: the path to the directory where package will be createdorganisation.name
: the name of the organisation in which the package will be created. For Epiverse TRACE, this will beepiverse-trace
. For Karim’s github account, this will beKarim-Mane
createPackage(package.name="test",
where="/Users/km28/Documents/Karim/Karim/LSHTM/Codes",
organisation.name="Karim-Mane")
Use the setUpPackageComponents() to set up the package components
i.e. to: * set up a licence,
* create a Readme file,
* set up unit testing infrastructure,
* set up a pkgdown website,
setUpPackageComponents()
To build the Readme.md file from the README.Rmd file, use the updateReadMe(). This function needs to be called after any modification of the README.Rmd file.
updateReadMe()
The package website can be built using the pkgdown package in R. After editing all your functions and documentation files, use the buildPkgdownWebsite() function to build the website.
buildPkgdownWebsite()
Once identified, the list of packages on which the current package depends on can will be added to the DESCRIPTION file using the addPkgDepencies() function. The function expects the following parameters:
dependencies
: a vector of packages on which the package to be built depends on
addPkgDepencies(dependencies=c("devtools","usethis","pkgdown","covr"))
When you are satisfied with the documentation of all the functions, use
the buildPkgDocumentation() to build the documentation files in the
man/
folder and update the NAMESPACE file.
buildPkgDocumentation()
For any changes/updates made on any of the files of the package use the command below to update the remote GitHub account.
git add .
git commit -a -m "updates"
git push origin master