Learn R Programming

⚠️There's a newer version (1.10.0) of this package.Take me there.

arkhe

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 (2023). _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.4.0, <https://packages.tesselle.org/arkhe/>.

A BibTeX entry for LaTeX users is

  @Manual{,
    author = {Nicolas Frerebeau},
    title = {{arkhe: Tools for Cleaning Rectangular Data}},
    year = {2023},
    organization = {Université Bordeaux Montaigne},
    address = {Pessac, France},
    note = {R package version 1.4.0},
    url = {https://packages.tesselle.org/arkhe/},
    doi = {10.5281/zenodo.3526659},
  }

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 GitHub with:

# install.packages("remotes")
remotes::install_github("tesselle/arkhe")

Usage

## Load the package
library(arkhe)

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

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

## 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  TRUE FALSE  TRUE FALSE

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

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

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.

Copy Link

Version

Install

install.packages('arkhe')

Monthly Downloads

1,015

Version

1.4.0

License

GPL (>= 3)

Issues

Pull Requests

Stars

Forks

Maintainer

Nicolas Frerebeau

Last Published

November 17th, 2023

Functions in arkhe (1.4.0)

compact

Remove Empty Rows/Columns
concat

Concatenate
jackknife

Jackknife Estimation
keep

Keep Rows/Columns Using a Predicate
inch2line

Plotting Dimensions of Character Strings
infinite

Tools for Working With Infinite Values
interval_credible

Bayesian Credible Interval
confidence_multinomial

Confidence Interval for Multinomial Proportions
confidence_mean

Confidence Interval for a Mean
predicate-numeric

Numeric Predicates
predicate-scalar

Scalar Type Predicates
label_auto

Non-Overlapping Text Labels
interval_hdr

Highest Density Regions
null

Default value for NULL
check-numeric

Check Numeric Values
predicate-matrix

Matrix Predicates
assign

Assign a Specific Row/Column to the Column/Row Names
predicate-type

Type Predicates
predicate-trend

Numeric Trend Predicates
label_percent

Label Percentages
discard

Remove Rows/Columns Using a Predicate
empty

Tools for Working With Empty String
needs

Check the Availability of a Package
missing

Tools for Working With Missing Values
circle

Draw a Circle
check_class

Class Diagnostic
check-type

Check Data Types
count

Count Values Using a Predicate
scale_range

Rescale Continuous Vector
validate

Validate a Condition
predicate-utils

Utility Predicates
detect

Find Rows/Columns Using a Predicate
math_gcd

Greatest Common Divisor
math_lcm

Least Common Multiple
with_seed

Evaluate an Expression with a Temporarily Seed
zero

Tools for Working With Zeros
remove_constant

Remove Constant Columns
arkhe-deprecated

Deprecated Functions in arkhe
append

Convert Row Names to an Explicit Column
check-numeric-trend

Check Numeric Trend
bootstrap

Bootstrap Estimation
check-attribute

Check Object Attributes
check-numeric-comparison

Check Numeric Relations
check-matrix

Check Matrix
check-data

Check Data
confidence_binomial

Confidence Interval for Binomial Proportions
arkhe-package

arkhe: Tools for Cleaning Rectangular Data
conditions

Conditions