-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathREADME.Rmd
More file actions
190 lines (154 loc) · 6.76 KB
/
README.Rmd
File metadata and controls
190 lines (154 loc) · 6.76 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
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
---
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 = NULL
)
Sys.setenv(LANGUAGE = "en") # Force locale
```
# arkhe <img width=120px src="man/figures/logo.png" align="right" />
<!-- badges: start -->
[](https://ci.codeberg.org/repos/14688){.pkgdown-devel}
[](https://packages.tesselle.org/arkhe/coverage/){.pkgdown-devel}
[](https://cran.r-project.org/package=arkhe){.pkgdown-devel}
[](https://tesselle.r-universe.dev/arkhe){.pkgdown-devel}
[](https://cran.r-project.org/package=arkhe){.pkgdown-release}
[](https://cran.r-project.org/web/checks/check_results_arkhe.html){.pkgdown-release}
[](https://cran.r-project.org/package=arkhe){.pkgdown-release}
[](https://www.repostatus.org/#active)
[](https://doi.org/10.5281/zenodo.3526659)
<!-- badges: end -->
## Overview
A dependency-free collection of simple functions for cleaning rectangular data. This package allows to detect, count and replace values or discard rows/columns using a predicate function. In addition, it provides tools to check conditions and return informative error messages.
---
```{r citation, echo=FALSE, comment='', results='asis'}
cite <- utils::citation("arkhe")
print(cite, bibtex = FALSE)
```
## Installation
You can install the released version of **arkhe** from [CRAN](https://CRAN.R-project.org) with:
```{r cran-installation, eval=FALSE}
install.packages("arkhe")
```
And the development version from [Codeberg](https://codeberg.org/) with:
```{r gh-installation, eval=FALSE}
# install.packages("remotes")
remotes::install_git("https://codeberg.org/tesselle/arkhe")
```
## Usage
```{r}
## Load the package
library(arkhe)
## Set seed for reproductibility
set.seed(12345)
## Create a matrix
X <- matrix(sample(1:10, 25, TRUE), nrow = 5, ncol = 5)
## Add NA
k <- sample(1:25, 3, FALSE)
X[k] <- NA
X
## Count missing values in rows
count(X, f = is.na, margin = 1)
## Count non-missing values in columns
count(X, f = is.na, margin = 2, negate = TRUE)
## Find row with NA
detect(X, f = is.na, margin = 1)
## Find column without any NA
detect(X, f = is.na, margin = 2, negate = TRUE, all = TRUE)
## Remove row with any NA
discard(X, f = is.na, margin = 1, all = FALSE)
## Remove column with any NA
discard(X, f = is.na, margin = 2, all = FALSE)
## Replace NA with zeros
replace_NA(X, value = 0)
```
## Translation
This package provides translations of user-facing communications, like messages, warnings and errors. The preferred language is by default taken from the locale. This can be overridden by setting of the environment variable `LANGUAGE` (you only need to do this once per session):
``` r
Sys.setenv(LANGUAGE = "<language code>")
```
Languages currently available are English (`en`), French (`fr`) and Spanish (`es`).
## Contributing
Please note that the **arkhe** project is released with a [Contributor Code of Conduct](https://www.tesselle.org/conduct.html). By contributing to this project, you agree to abide by its terms.
```{r metadata, include=FALSE}
## Update codemeta.json
codemetar::write_codemeta(verbose = FALSE)
## Update CITATION.cff
cff_keys <- list(
identifiers = list(
list(description = "The concept DOI.",
type = "doi",
value = "10.5281/zenodo.3526659"),
list(description = "The versioned DOI for version 0.1.0.",
type = "doi",
value = "10.5281/zenodo.3526660"),
list(description = "The versioned DOI for version 0.2.0.",
type = "doi",
value = "10.5281/zenodo.3583089"),
list(description = "The versioned DOI for version 0.2.1.",
type = "doi",
value = "10.5281/zenodo.3668868"),
list(description = "The versioned DOI for version 0.2.2.",
type = "doi",
value = "10.5281/zenodo.3724463"),
list(description = "The versioned DOI for version 0.3.0.",
type = "doi",
value = "10.5281/zenodo.4675724"),
list(description = "The versioned DOI for version 0.3.1.",
type = "doi",
value = "10.5281/zenodo.4761928"),
list(description = "The versioned DOI for version 0.4.0.",
type = "doi",
value = "10.5281/zenodo.5515470"),
list(description = "The versioned DOI for version 0.5.0.",
type = "doi",
value = "10.5281/zenodo.6647041"),
list(description = "The versioned DOI for version 1.0.0.",
type = "doi",
value = "10.5281/zenodo.7261616"),
list(description = "The versioned DOI for version 1.1.0.",
type = "doi",
value = "10.5281/zenodo.7546749"),
list(description = "The versioned DOI for version 1.2.0.",
type = "doi",
value = "10.5281/zenodo.7925529"),
list(description = "The versioned DOI for version 1.3.0.",
type = "doi",
value = "10.5281/zenodo.8308598"),
list(description = "The versioned DOI for version 1.4.0.",
type = "doi",
value = "10.5281/zenodo.10148702"),
list(description = "The versioned DOI for version 1.5.0.",
type = "doi",
value = "10.5281/zenodo.10534310"),
list(description = "The versioned DOI for version 1.6.0.",
type = "doi",
value = "10.5281/zenodo.10694357"),
list(description = "The versioned DOI for version 1.7.0.",
type = "doi",
value = "10.5281/zenodo.13121710"),
list(description = "The versioned DOI for version 1.8.0.",
type = "doi",
value = "10.5281/zenodo.14054350"),
list(description = "The versioned DOI for version 1.9.0.",
type = "doi",
value = "10.5281/zenodo.14355274"),
list(description = "The versioned DOI for version 1.10.0.",
type = "doi",
value = "10.5281/zenodo.14926270"),
list(description = "The versioned DOI for version 1.11.0.",
type = "doi",
value = "10.5281/zenodo.15390837"),
list(description = "The CRAN DOI",
type = "doi",
value = "10.32614/cran.package.arkhe")
)
)
cff <- cffr::cff_create("DESCRIPTION", keys = cff_keys)
if (cffr::cff_validate(cff)) cffr::cff_write(cff, outfile = "CITATION.cff")
```