This repository was archived by the owner on May 29, 2021. It is now read-only.
Repository navigation
Expand file tree
/
Copy pathREADME.Rmd
More file actions
82 lines (61 loc) · 2.1 KB
/
Copy pathREADME.Rmd
File metadata and controls
82 lines (61 loc) · 2.1 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
---
output: github_document
bibliography: [./inst/REFERENCES.bib]
biblio-style: apalike
link-citations: yes
editor_options:
canonical: true
markdown:
wrap: 80
references:
location: section
---
```{r, include = FALSE}
source(file.path(usethis::proj_get(), "vignettes", "_common.R"))
```
# `typing` <img src="https://raw.githubusercontent.com/tidylab/typing/master/pkgdown/logo.png" align="right" height="75"/>
<!-- badges: start -->
[](https://CRAN.R-project.org/package=typing)
[](https://github.com/tidylab/typing/actions)
[](https://codecov.io/gh/tidylab/typing)
<!-- badges: end -->
## Features
| Feature | Example |
|---------------|--------------------------------------------------------------|
| Define types | `type.numeric <- typeCheck::type_define(check = is.numeric)` |
| Declare types | `f <- function(x = ? numeric) identity(x)` |
| Check types | `f <- typeCheck::type_check(f)` |
<!-- ## Example -->
```{r, echo=!TRUE, eval=FALSE}
# `?` <- types::`?`
type.numeric <- typeCheck::type_define(check = is.numeric)
type.null <- typeCheck::type_define(check = is.null)
f <- function(x = 1 ? numeric ? null) {
x + 1
}
g <- typeCheck::type_check(f)
f(x = TRUE)
g(x = NULL)
g(x = TRUE)
# g <- function(x = ? numeric) {
# x + 1
# }
```
## Installation
You can install the released version of `typing` from CRAN with:
``` r
install.packages("typing")
```
And the development version from GitHub with:
``` r
# install.packages("remotes")
remotes::install_github("tidylab/typing")
```
<!--
* https://github.com/jimhester/types
* https://github.com/jimhester/typeCheck
* https://docs.python.org/3/library/typing.html#module-typing
* https://www.python.org/dev/peps/pep-0484/
-->