Skip to content

Commit 9ed2ee7

Browse files
committed
Closes #1: provide installation in detail
1 parent 337ac76 commit 9ed2ee7

File tree

2 files changed

+91
-19
lines changed

2 files changed

+91
-19
lines changed

README.Rmd

+41-3
Original file line numberDiff line numberDiff line change
@@ -28,9 +28,47 @@ It's similar to the `lubridate` package but is much lighter and focuses only on
2828

2929
## Installation
3030

31-
Note, in order to compile this package from source you need the Rust toolchain, which can be found in [Rust's official website](https://www.rust-lang.org).
31+
### Binary version (no Rust toolchain required)
3232

33-
## Some use case and benchmarks
33+
The binary package is provided by CRAN. So, if you are on Windows or macOS, the package can be installed via:
34+
35+
```r
36+
install.packages("ymd")
37+
```
38+
39+
If you are on Linux, you can try to use the [RSPM (RStudio Package Manager) repo](https://packagemanager.rstudio.com)
40+
provided by RStudio PBC, via (remember to choose the correct binary repo URL for your platform):
41+
42+
```r
43+
install.packages("ymd", repos = "{RSPM-Repo-URL}")
44+
```
45+
46+
In addition, you may download the binary package file generated by GitHub Action
47+
from [the release page](https://github.com/shrektan/ymd/releases) and install via:
48+
49+
```r
50+
install.packages("{the-downloaded-binary-pkg-file}", repos = NULL)
51+
```
52+
53+
| artifact | platform |
54+
|:----------------------------------------|--------------:|
55+
| ymd_0.0.1.tgz | macOS Intel |
56+
| ymd_0.0.1.zip | Windows |
57+
| ymd_0.0.1_R_x86_64-pc-linux-gnu.tar.gz | Ubuntu-18.04 |
58+
59+
60+
### Source version (Rust toolchain required)
61+
62+
If you want to build the dev version from source, you'll need the Rust toolchain, which
63+
can be installed following [the instructions from the Rust book](https://doc.rust-lang.org/book/ch01-01-installation.html).
64+
65+
After that, you can build the package via:
66+
67+
```r
68+
remotes::install_github("ymd")
69+
```
70+
71+
## Some use cases and benchmarks
3472

3573
```{r benchmark, results='asis'}
3674
print_bmk <- function(x) {
@@ -39,7 +77,7 @@ print_bmk <- function(x) {
3977
rnd <- \(v) if (is.numeric(v)) round(v, 1) else v
4078
x[, 1:9] |> lapply(rnd) |> as.data.frame() |> knitr::kable() |> print()
4179
}
42-
x <- c("210101", "21/02/03", "89-1-03", "1989.03.05")
80+
x <- c("210101", "21/02/03", "89-1-03", "1989.03.05", "01 02 03")
4381
x <- rep(x, 100)
4482
bench::mark(
4583
ymd::ymd(x),

README.md

+50-16
Original file line numberDiff line numberDiff line change
@@ -11,9 +11,43 @@ It's similar to the `lubridate` package but is much lighter and focuses only on
1111

1212
## Installation
1313

14-
Note, in order to compile this package from source you need the Rust toolchain, which can be found in [Rust's official website](https://www.rust-lang.org).
14+
### Binary version (no Rust toolchain required)
1515

16-
## Some use case and benchmarks
16+
The binary package is provided by CRAN. So, if you are on Windows or macOS, the package can be installed via:
17+
18+
``` r
19+
install.packages("ymd")
20+
```
21+
22+
If you are on Linux, you can try to use the [RSPM (RStudio Package Manager) repo](https://packagemanager.rstudio.com) provided by RStudio PBC, via (remember to choose the correct binary repo URL for your platform):
23+
24+
``` r
25+
install.packages("ymd", repos = "{RSPM-Repo-URL}")
26+
```
27+
28+
In addition, you may download the binary package file generated by GitHub Action from [the release page](https://github.com/shrektan/ymd/releases) and install via:
29+
30+
``` r
31+
install.packages("{the-downloaded-binary-pkg-file}", repos = NULL)
32+
```
33+
34+
| artifact | platform|
35+
|:-------------------------------------------|-------------:|
36+
| ymd\_0.0.1.tgz | macOS Intel|
37+
| ymd\_0.0.1.zip | Windows|
38+
| ymd\_0.0.1\_R\_x86\_64-pc-linux-gnu.tar.gz | Ubuntu-18.04|
39+
40+
### Source version (Rust toolchain required)
41+
42+
If you want to build the dev version from source, you'll need the Rust toolchain, which can be installed following [the instructions from the Rust book](https://doc.rust-lang.org/book/ch01-01-installation.html).
43+
44+
After that, you can build the package via:
45+
46+
``` r
47+
remotes::install_github("ymd")
48+
```
49+
50+
## Some use cases and benchmarks
1751

1852
``` r
1953
print_bmk <- function(x) {
@@ -22,7 +56,7 @@ print_bmk <- function(x) {
2256
rnd <- \(v) if (is.numeric(v)) round(v, 1) else v
2357
x[, 1:9] |> lapply(rnd) |> as.data.frame() |> knitr::kable() |> print()
2458
}
25-
x <- c("210101", "21/02/03", "89-1-03", "1989.03.05")
59+
x <- c("210101", "21/02/03", "89-1-03", "1989.03.05", "01 02 03")
2660
x <- rep(x, 100)
2761
bench::mark(
2862
ymd::ymd(x),
@@ -32,8 +66,8 @@ bench::mark(
3266

3367
| expression | min| median| itr.sec| mem\_alloc | gc.sec| n\_itr| n\_gc| total\_time|
3468
|:------------------|-------:|-------:|--------:|:-----------|-------:|-------:|------:|------------:|
35-
| ymd::ymd(x) | 32.8| 33.7| 29107.3| 214.27KB | 0.0| 10000| 0| 343556.5|
36-
| lubridate::ymd(x) | 1843.0| 1932.1| 511.4| 8.19MB | 19.9| 231| 9| 451659.5|
69+
| ymd::ymd(x) | 43.5| 44.9| 21741.3| 214.34KB | 0.0| 10000| 0| 459953.4|
70+
| lubridate::ymd(x) | 1537.7| 1580.4| 628.9| 8.23MB | 15.2| 290| 7| 461145.0|
3771

3872
``` r
3973

@@ -47,8 +81,8 @@ bench::mark(
4781

4882
| expression | min| median| itr.sec| mem\_alloc | gc.sec| n\_itr| n\_gc| total\_time|
4983
|:------------------|-------:|-------:|--------:|:-----------|-------:|-------:|------:|------------:|
50-
| ymd::ymd(x) | 11.8| 12.4| 78836.5| 3.17KB | 0.0| 10000| 0| 126844.8|
51-
| lubridate::ymd(x) | 1707.7| 1843.4| 527.9| 373.41KB | 19.8| 240| 9| 454630.2|
84+
| ymd::ymd(x) | 11.8| 12.3| 79023.1| 3.17KB | 0.0| 10000| 0| 126545.2|
85+
| lubridate::ymd(x) | 1685.6| 1712.4| 580.6| 373.41KB | 19.6| 267| 9| 459892.4|
5286

5387
``` r
5488

@@ -63,9 +97,9 @@ bench::mark(
6397

6498
| expression | min| median| itr.sec| mem\_alloc | gc.sec| n\_itr| n\_gc| total\_time|
6599
|:------------------|------:|-------:|--------:|:-----------|-------:|-------:|------:|------------:|
66-
| ymd::ymd(x) | 32.0| 32.6| 30097.2| 2.39KB | 0.0| 10000| 0| 332257.2|
67-
| lubridate::ymd(x) | 787.2| 837.2| 1172.8| 201.1KB | 19.6| 539| 9| 459576.8|
68-
| as.Date(x) | 659.6| 690.4| 1435.8| 87.54KB | 2.0| 711| 1| 495201.9|
100+
| ymd::ymd(x) | 31.9| 32.6| 30322.0| 2.39KB | 0.0| 10000| 0| 329794.0|
101+
| lubridate::ymd(x) | 782.9| 797.6| 1243.3| 201.1KB | 21.6| 575| 10| 462486.3|
102+
| as.Date(x) | 664.3| 673.3| 1473.2| 87.54KB | 0.0| 737| 0| 500261.1|
69103

70104
``` r
71105

@@ -78,8 +112,8 @@ bench::mark(
78112

79113
| expression | min| median| itr.sec| mem\_alloc | gc.sec| n\_itr| n\_gc| total\_time|
80114
|:-----------------------------------------|-----:|-------:|---------:|:-----------|-------:|-------:|------:|------------:|
81-
| ymd::eop$tm(x) | 5.5| 5.9| 164290.1| 19.3KB | 0.0| 10000| 0| 60867.9|
82-
| lubridate::ceiling\_date(x, "month") - 1 | 94.5| 101.4| 9547.0| 255.1KB | 35.6| 4285| 16| 448832.8|
115+
| ymd::eop$tm(x) | 5.5| 5.9| 163533.7| 19.3KB | 16.4| 9999| 1| 61143.4|
116+
| lubridate::ceiling\_date(x, "month") - 1 | 93.6| 99.0| 9951.5| 255.1KB | 35.2| 4518| 16| 454003.5|
83117

84118
``` r
85119

@@ -94,8 +128,8 @@ bench::mark(
94128

95129
| expression | min| median| itr.sec| mem\_alloc | gc.sec| n\_itr| n\_gc| total\_time|
96130
|:-----------------|------:|-------:|--------:|:-----------|-------:|-------:|------:|------------:|
97-
| ymd::edate(x, 2) | 13.2| 13.8| 70377.8| 6.2KB | 0.0| 10000| 0| 142090.2|
98-
| x %m+% months(2) | 293.6| 309.5| 3197.9| 424.6KB | 23.7| 1485| 11| 464365.5|
131+
| ymd::edate(x, 2) | 13.2| 13.9| 70519.6| 6.2KB | 7.1| 9999| 1| 141790.4|
132+
| x %m+% months(2) | 294.8| 307.2| 3227.5| 424.6KB | 23.5| 1511| 11| 468162.7|
99133

100134
``` r
101135
bench::mark(
@@ -106,5 +140,5 @@ bench::mark(
106140

107141
| expression | min| median| itr.sec| mem\_alloc | gc.sec| n\_itr| n\_gc| total\_time|
108142
|:-------------------|------:|-------:|--------:|:-----------|-------:|-------:|------:|------------:|
109-
| ymd::edate(x, -12) | 13.3| 14.0| 70184.0| 3.95KB | 0.0| 10000| 0| 142482.6|
110-
| x %m+% months(-12) | 793.4| 829.1| 1189.7| 317.19KB | 32.7| 509| 14| 427843.8|
143+
| ymd::edate(x, -12) | 13.3| 14.0| 70151.2| 3.95KB | 0.0| 10000| 0| 142549.2|
144+
| x %m+% months(-12) | 791.5| 820.9| 1210.4| 317.19KB | 35.1| 518| 15| 427950.4|

0 commit comments

Comments
 (0)