https://github.com/joeroe/numerals
R package for numeric vectors with Unicode numerals
https://github.com/joeroe/numerals
arabic-numerals bengali-numerals burmese-numerals numerals persian-numerals r r-package vctrs
Last synced: 3 months ago
JSON representation
R package for numeric vectors with Unicode numerals
- Host: GitHub
- URL: https://github.com/joeroe/numerals
- Owner: joeroe
- License: other
- Created: 2021-02-05T13:25:23.000Z (over 4 years ago)
- Default Branch: master
- Last Pushed: 2023-05-14T11:23:06.000Z (about 2 years ago)
- Last Synced: 2025-01-16T12:52:33.613Z (4 months ago)
- Topics: arabic-numerals, bengali-numerals, burmese-numerals, numerals, persian-numerals, r, r-package, vctrs
- Language: R
- Homepage: https://numerals.joeroe.io
- Size: 422 KB
- Stars: 1
- Watchers: 3
- Forks: 0
- Open Issues: 9
-
Metadata Files:
- Readme: README.Rmd
- License: LICENSE
Awesome Lists containing this project
README
---
output: github_document
---```{r, include = FALSE}
knitr::opts_chunk$set(
collapse = TRUE,
comment = "#>",
fig.path = "man/figures/README-",
out.width = "100%"
)
```# numerals
[](https://www.repostatus.org/#concept)
[](https://CRAN.R-project.org/package=numerals)
[](https://github.com/joeroe/numerals/actions/workflows/R-CMD-check.yaml)**numerals** is an R package that extends the base numeric types with methods for printing using Unicode digits in other numeral systems.
It currently supports Eastern Arabic (`"ar"`), Bengali (`"bn"`), Persian (`"fa"`), and Burmese (`"my"`) numerals.## Installation
You can install the development version of numerals from GitHub using [devtools](https://devtools.r-lib.org/):
```r
# install.package("devtools")
devtools::install_github("joeroe/numerals")
```numerals has not yet been released on CRAN.
## Usage
`numeral()` creates a numeric vector which is printed in another numeral system:
```{r eg-numerals}
library("numerals")
# Eastern Arabic numerals
numeral(1:10, "ar")# Persian numerals
numeral(1:10, "fa")
```Numerals are compatible with both base and tidyverse packages.
For example, they are printed in data frames and [tibbles](https://tibble.tidyverse.org/):```{r eg-tibbles}
library("tibble")
x <- data.frame(en = 1:10, ar = numeral(1:10, "ar"), fa = numeral(1:10, "fa"))x
as_tibble(x)
```Otherwise, numerals are freely coercible to base numerics and so can be used in calculations:
```{r eg-calc}
numeral(2, "ar") * 10
```