The {gcd} package offers two functions:
gcd()
: greatest common divisor of two numbers.lcm()
: least common multiple of two numbers.
The main purpose of this repo is to show how to build a simple R package:
- Put all functions into one or more R scripts in folder "R"
- Document them with Roxygen
- Go through script "packaging.R"
To test it yourself:
- Clone repo
- Delete everything except "R/gcd" and script "packaging.R"
- Go through script "packaging.R"
You can install the development version of gcd from GitHub with:
# install.packages("devtools")
devtools::install_github("mayer79/gcd")
library(gcd)
a <- 123
b <- 10947
gcd(a, b) # 123
lcm(a, b) # 10947