-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathREADME.Rmd
More file actions
90 lines (65 loc) · 2.51 KB
/
Copy pathREADME.Rmd
File metadata and controls
90 lines (65 loc) · 2.51 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
---
output: github_document
---
<!-- README.md is generated from README.Rmd. Please edit that file -->
```{r, include = FALSE}
knitr::opts_chunk$set(
collapse = TRUE,
comment = "#>",
fig.path = "man/figures/README-",
out.width = "100%"
)
```
# numerals
<!-- badges: start -->
[](https://www.repostatus.org/#concept)
[](https://CRAN.R-project.org/package=numerals)
[](https://github.com/joeroe/numerals/actions/workflows/R-CMD-check.yaml)
<!-- badges: end -->
**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.
<!--
You can install the released version of numerals from [CRAN](https://CRAN.R-project.org) with:
``` r
install.packages("numerals")
```
-->
## 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)
```
<!--
And can be used as scales in base and [ggplot2](https://ggplot2.tidyverse.org/):
```{r eg-plot, echo=FALSE, fig.show="hold", out.width="50%"}
library("ggplot2")
data(pressure)
pressure$temperature <- numeral(pressure$temperature, "ar")
pressure$pressure <- numeral(pressure$pressure, "ar")
plot(pressure$temperature, pressure$pressure)
ggplot(pressure, aes(temperature, pressure)) + geom_point()
```
-->
Otherwise, numerals are freely coercible to base numerics and so can be used in calculations:
```{r eg-calc}
numeral(2, "ar") * 10
```