Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/mayer79/gcd
Greatest common divisor
https://github.com/mayer79/gcd
educational r r-package recreational
Last synced: 15 days 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 (over 1 year ago)
- Default Branch: main
- Last Pushed: 2023-05-19T16:49:32.000Z (over 1 year ago)
- Last Synced: 2024-10-04T12:56:52.405Z (3 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
[![CRAN status](http://www.r-pkg.org/badges/version/gcd)](https://cran.r-project.org/package=gcd)
[![R-CMD-check](https://github.com/mayer79/gcd/actions/workflows/check-standard.yaml/badge.svg)](https://github.com/mayer79/gcd/actions)
[![Codecov test coverage](https://codecov.io/gh/mayer79/gcd/branch/main/graph/badge.svg)](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
```