-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathREADME.Rmd
94 lines (65 loc) · 1.87 KB
/
README.Rmd
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
91
92
93
94
---
output: github_document
---
<!-- README.md is generated from README.Rmd. Please edit that file -->
```{r, include=FALSE}
# nolint start: nonportable_path_linter, undesirable_function_linter, library_call_linter.
knitr::opts_chunk$set(
collapse = TRUE,
comment = "#>",
fig.path = "man/figures/README-",
out.width = "100%"
)
```
# [JMF](https://jmf.univie.ac.at/) R utility functions <a href="https://jmf-vienna.github.io/jmf-r/"><img src="man/figures/logo.svg" align="right" height="120" alt="logo" /></a>
<!-- badges: start -->
[![R-CMD-check](https://github.com/jmf-vienna/jmf-r/actions/workflows/R-CMD-check.yaml/badge.svg)](https://github.com/jmf-vienna/jmf-r/actions/workflows/R-CMD-check.yaml)
[![Codecov test coverage](https://codecov.io/gh/jmf-vienna/jmf-r/branch/main/graph/badge.svg)](https://app.codecov.io/gh/jmf-vienna/jmf-r?branch=main)
<!-- badges: end -->
## Installation
Install the latest release from [GitHub](https://github.com/jmf-vienna/jmf-r) using [pak](https://pak.r-lib.org/):
```{r, eval=FALSE}
pak::pak("jmf-vienna/jmf-r@*release")
```
Or install the development version:
```{r, eval=FALSE}
pak::pak("jmf-vienna/jmf-r")
```
## Usage
### Reduce verbosity
```{r}
library(jmf)
quiet()
library(tidyverse)
```
### Utils
Stable combined `unique()` and `sort()`:
```{r}
x <- c(
"a", "vector", "of", "strings",
"and", "some", "letters", ":", NA,
"a", "b", "c", "and", "A", "B", "C"
)
x |> uniques()
```
### Shortcuts
* available (i.e., not `NA`): `a()`
* not available (i.e., `NA`): `na()`
```{r}
starwars |>
select(name, birth_year, hair_color) |>
filter(a(birth_year), na(hair_color))
```
### Validation of JMF IDs
```{r}
# valid JMF project ID:
is_jmf_project_id("JMF-2401-42")
# this is a JMF sample ID:
is_jmf_project_id("JMF-2401-42-0001")
```
```{r}
jmf_project_id_regex(internal = "allow")
```
```{r, include=FALSE}
# nolint end
```