Algoritma Academy Internal Package
Use the following command to install the package:
devtools::install_github("teamalgoritma/AlgoritmaAcademy")
Make sure to install these packages to develop the R package:
install.packages(c("devtools", "usethis", "roxygen2"))
Step-by-step on how to create a new function:
- Download the
AlgoritmaAcademy
package - Open RStudio via
AlgoritmaAcademy.Rproj
- Create new function using
usethis::use_r(name = "function_name")
- Code the function inside the newly created R script. The path of the script is in the
R
folder - Documentate the function inside the R script:
- Hover over the function
- Click "Code" -> "Insert roxygen skeleton"
- Complete the documentation, then save
- Use
devtools::document()
so that the documentation can be seen - If the script uses an external library, make sure the library is listed in the
DESCRIPTION
file
- Use
devtools::load_all()
to find out if the created function is running or not - Test the function
- If okay, update the documentation of the function by using
devtools::document()
- To check whether there is an error/warning in the package, you can use
devtools::check()
- To install package to global environment (your laptop) use
devtools::install()
- Restart RStudio, load the package by using
library(AlgoritmaAcademy)
, and then try to use the created function - If okay, push the code to GitHub
Step-by-step on how to update a function:
- Download the
AlgoritmaAcademy
package - Open RStudio via
AlgoritmaAcademy.Rproj
and open the R script you want to edit inside theR
folder - Update the function accordingly. Make sure to update the documentation also
- Use
devtools::load_all()
to find out if the updated function is running or not - Test the function
- If okay, update the documentation of the function by using
devtools::document()
- To check whether there is an error/warning in the package, you can use
devtools::check()
- To install package to global environment (your laptop) use
devtools::install()
- Restart RStudio, load the package by using
library(AlgoritmaAcademy)
, and then try to use the updated function - If okay, push the code to GitHub