CRAN status Codecov test coverage Downloads R-CMD-check test-coverage

nuggets

Fast and extensible pattern mining in R - fuzzy association rules, conditional correlations, and contrast patterns

nuggets is a package for R providing a fast and extensible framework for discovering interesting patterns in tabular data. It can find association rules, contrasts, subgroup patterns, conditional correlations, and other patterns defined by user-specified evaluation functions. Both Boolean and fuzzy predicates are supported. Efficient implementation enables pattern discovery on large and dense data sets. Package includes methods for visualization and supports interactive exploration through integrated Shiny applications.

What Patterns Can You Discover?

Why nuggets?

arules is the established R framework for transaction-based association-rule and frequent-itemset mining. The nuggets package takes a broader approach: it searches combinations of conditions and evaluates the observations they select. This makes association rules just one of several types of patterns that can be discovered.

Key advantages of nuggets include:

Fast on Dense Datasets

A lot of effort has been put into optimizing the performance of the package, especially for dense datasets. The core algorithms are implemented in C++ and use single-instruction multiple-data (SIMD) operations to speed up the operations.

On a randomly generated dataset with 1 million rows and 15 columns, association rules with at most 5 items in the antecedent, a support above 0.001, and a confidence above 0.5 were searched. The total times, including reading the data from the CSV file, searching for rules, and writing the result back to CSV, on a Linux desktop computer with standard installations of the packages, were as follows:

Fuzzy variant of association rules, which is much more computationally intensive:

For comparison, two Python libraries performed as follows:

Installation

To install the stable version of nuggets from CRAN, type the following command within the R session:

install.packages("nuggets", dependencies = TRUE)

You can also install the development version of nuggets from GitHub with:

install.packages("devtools")
devtools::install_github("beerda/nuggets")

To start using the package, load it to the R session with:

library(nuggets)

Minimal Example

The following example demonstrates how to use nuggets to find association rules in the built-in mtcars dataset:

# Preprocess: dichotomize and fuzzify numeric variables
cars <- mtcars |>
    partition(cyl, vs:gear, .method = "dummy") |>
    partition(carb, .method = "crisp", .breaks = c(0, 3, 10)) |>
    partition(mpg, disp:qsec, .method = "triangle", .breaks = 3)

# Search for associations among conditions
rules <- dig_associations(cars,
                          antecedent = everything(),
                          consequent = everything(),
                          max_length = 4,
                          min_support = 0.1)

# Add various interest measures
rules <- add_interest(rules)

# Explore the found rules interactively
explore(rules, cars)

Documentation

Read the full documentation of the nuggets package.

Vignettes

The package currently includes the following vignettes:

Contributing

Contributions, suggestions, and bug reports are welcome. Please submit issues on GitHub.

License

This package is licensed under the GPL-3 license.

It includes third-party code licensed under BSD-2-Clause, BSD-3-Clause, and GPL-2 or later licenses. See inst/COPYRIGHTS for details.

References

Burda, M. Accelerating Pattern Mining on Fuzzy Data by Packing Truth Values into Blocks of Bits. Applied Soft Computing. 2026, 191 (April 2026), ISSN 1568-4946.