https://github.com/mayer79/gcd
Greatest common divisor
https://github.com/mayer79/gcd
educational r r-package recreational
Last synced: 4 months ago
JSON representation
Greatest common divisor
- Host: GitHub
- URL: https://github.com/mayer79/gcd
- Owner: mayer79
- License: gpl-2.0
- Created: 2023-05-18T06:31:54.000Z (about 2 years ago)
- Default Branch: main
- Last Pushed: 2023-05-19T16:49:32.000Z (about 2 years ago)
- Last Synced: 2025-02-05T03:56:25.073Z (5 months ago)
- Topics: educational, r, r-package, recreational
- Language: R
- Homepage: https://mayer79.github.io/gcd/
- Size: 51.8 KB
- Stars: 0
- Watchers: 2
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- Changelog: NEWS.md
- License: LICENSE.md
Awesome Lists containing this project
README
# gcd
[](https://cran.r-project.org/package=gcd)
[](https://github.com/mayer79/gcd/actions)
[](https://app.codecov.io/gh/mayer79/gcd?branch=main)## Overview
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**:
1. Put all functions into one or more R scripts in folder "R"
2. Document them with Roxygen
3. Go through script "packaging.R"To test it yourself:
1. Clone repo
2. Delete everything except "R/gcd" and script "packaging.R"
3. Go through script "packaging.R"## Installation
You can install the development version of gcd from [GitHub](https://github.com/) with:
``` r
# install.packages("devtools")
devtools::install_github("mayer79/gcd")
```## Usage
``` r
library(gcd)a <- 123
b <- 10947gcd(a, b) # 123
lcm(a, b) # 10947
```