🔧 Tools for cleaning rectangular data https://packages.tesselle.org/arkhe/
Find a file
nfrerebeau cc90b6b519
All checks were successful
ci/woodpecker/push/pkgdown Pipeline was successful
ci/woodpecker/push/R-CMD-check Pipeline was successful
ci/woodpecker/push/coverage Pipeline was successful
Small fix
2025-09-05 10:56:51 +02:00
.woodpecker Add Woodpecker workflow 2025-09-05 10:56:42 +02:00
data-raw Add fake data for testing 2023-10-27 14:55:14 +02:00
inst Translated using Weblate (Spanish) 2025-06-03 15:58:24 +00:00
man [SKIP CI] Add R-universe URL 2025-05-18 14:15:29 +02:00
pkgdown Update pkgdown configuration 2024-11-06 11:16:15 +01:00
po Translated using Weblate (Spanish) 2025-06-03 15:58:24 +00:00
R Small fix 2025-09-05 10:56:51 +02:00
revdep Reverse dependencies check 2025-05-12 16:26:21 +02:00
tests Add Woodpecker workflow 2025-09-05 10:56:42 +02:00
.covrignore Add coverage badge 2025-03-04 00:10:18 +01:00
.gitattributes Add Woodpecker workflows 2025-05-17 13:44:00 +02:00
.gitignore Update pkgdown configuration 2023-11-16 15:54:10 +01:00
.Rbuildignore Add Woodpecker workflows 2025-05-17 13:44:00 +02:00
arkhe.Rproj Update RStudio project 2025-02-25 15:24:09 +01:00
CITATION.cff Bump package version 2025-05-12 20:26:24 +02:00
codemeta.json Bump package version 2025-05-12 20:26:24 +02:00
cran-comments.md Reverse dependencies check 2025-05-12 16:26:21 +02:00
DESCRIPTION [SKIP CI] Add R-universe URL 2025-05-18 14:15:29 +02:00
LICENSE.md Fix license 2021-01-22 13:31:12 +01:00
NAMESPACE Add bootstrap confidence intervals 2025-05-11 14:21:24 +02:00
NEWS.md Bump package version 2025-05-12 20:26:24 +02:00
README.md Add Woodpecker workflows 2025-05-17 13:44:00 +02:00
README.Rmd Add Woodpecker workflows 2025-05-17 13:44:00 +02:00

arkhe

status-badge Code coverage Dependencies

r-universe CRAN Version CRAN checks CRAN Downloads

Project Status: Active – The project has reached a stable, usable
state and is being actively
developed.

DOI

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.


To cite arkhe in publications use:

Frerebeau N (2025). arkhe: Tools for Cleaning Rectangular Data. Université Bordeaux Montaigne, Pessac, France. doi:10.5281/zenodo.3526659 https://doi.org/10.5281/zenodo.3526659, R package version 1.11.0, https://packages.tesselle.org/arkhe/.

This package is a part of the tesselle project https://www.tesselle.org.

Installation

You can install the released version of arkhe from CRAN with:

install.packages("arkhe")

And the development version from Codeberg with:

# install.packages("remotes")
remotes::install_git("https://codeberg.org/tesselle/arkhe")

Usage

## 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
#>      [,1] [,2] [,3] [,4] [,5]
#> [1,]    3    2    1    4    4
#> [2,]   10    6    8    8   10
#> [3,]    8   NA    7   10    7
#> [4,]   NA   NA    6    3    2
#> [5,]    8   10    1    9    4

## Count missing values in rows
count(X, f = is.na, margin = 1)
#> [1] 0 0 1 2 0

## Count non-missing values in columns
count(X, f = is.na, margin = 2, negate = TRUE)
#> [1] 4 3 5 5 5

## Find row with NA
detect(X, f = is.na, margin = 1)
#> [1] FALSE FALSE  TRUE  TRUE FALSE

## Find column without any NA
detect(X, f = is.na, margin = 2, negate = TRUE, all = TRUE)
#> [1] FALSE FALSE  TRUE  TRUE  TRUE

## Remove row with any NA
discard(X, f = is.na, margin = 1, all = FALSE)
#>      [,1] [,2] [,3] [,4] [,5]
#> [1,]    3    2    1    4    4
#> [2,]   10    6    8    8   10
#> [3,]    8   10    1    9    4

## Remove column with any NA
discard(X, f = is.na, margin = 2, all = FALSE)
#>      [,1] [,2] [,3]
#> [1,]    1    4    4
#> [2,]    8    8   10
#> [3,]    7   10    7
#> [4,]    6    3    2
#> [5,]    1    9    4

## Replace NA with zeros
replace_NA(X, value = 0)
#>      [,1] [,2] [,3] [,4] [,5]
#> [1,]    3    2    1    4    4
#> [2,]   10    6    8    8   10
#> [3,]    8    0    7   10    7
#> [4,]    0    0    6    3    2
#> [5,]    8   10    1    9    4

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):

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. By contributing to this project, you agree to abide by its terms.