Learn R Programming

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

nuggets

nuggets is a package for R statistical computing environment providing a framework for systematic exploration of association rules (Agrawal (1994)), contrast patterns (Chen (2022)), emerging patterns (Dong (1999)), subgroup discovery (Atzmueller (2015)), and conditional correlations (Hájek (1978)). User-defined functions may also be supplied to guide custom pattern searches.

Supports both crisp (Boolean) and fuzzy data. Generates candidate conditions expressed as elementary conjunctions, evaluates them on a dataset, and inspects the induced sub-data for statistical, logical, or structural properties such as associations, correlations, or contrasts. Includes methods for visualization of logical structures and supports interactive exploration through integrated Shiny applications.

Key Features

  • Support for both categorical and numeric data.
  • Provides both Boolean and fuzzy logic approach.
  • Data preparation functions for easy pre-processing phase.
  • Functions for examining associations, conditional correlations, and contrasts among data variables.
  • Visualization and pattern post-processing tools.
  • Integrated Shiny applications for interactive exploration of discovered patterns.

Documentation

Read the full documentation of the nuggets package.

Installation

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

install.packages("nuggets")

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,
                          measures = c("lift", "conviction"))

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

Contributing

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

Copy Link

Version

Install

install.packages('nuggets')

Monthly Downloads

221

Version

2.0.0

License

GPL (>= 3)

Issues

Pull Requests

Stars

Forks

Maintainer

Michal Burda

Last Published

October 13th, 2025

Functions in nuggets (2.0.0)

dig_tautologies

Find tautologies or "almost tautologies" in a dataset
dig_paired_baseline_contrasts

Search for conditions that provide significant differences between paired variables
bound_range

Bound a range of numeric values
dig_correlations

Search for conditional correlations
dig_baseline_contrasts

Search for conditions that yield in statistically significant one-sample test in selected variables.
dig_associations

Search for association rules
dig

Search for patterns of a custom type
dig_grid

Search for grid-based rules
dichotomize

Create dummy columns from logicals or factors in a data frame
dig_complement_contrasts

Search for conditions that provide significant differences in selected variables to the rest of the data table
is_almost_constant

Test whether a vector is almost constant
explore.associations

Show interactive application to explore association rules
is_degree

Test whether an object contains numeric values from the interval \([0,1]\)
format_condition

Format a vector of predicates into a condition string
is_subset

Determine whether one vector is a subset of another
nugget

Create a nugget object of a given flavour
fire

Obtain truth-degrees of conditions
is_condition

Check whether a list of character vectors contains valid conditions
geom_diamond

Geom for drawing diamond plots of lattice structures
shorten_condition

Shorten predicates within conditions
is_nugget

Test whether an object is a nugget
values

Extract values from predicate names
remove_ill_conditions

Remove invalid conditions from a list
remove_almost_constant

Remove almost constant columns from a data frame
parse_condition

Convert condition strings into lists of predicate vectors
nuggets-package

nuggets: Extensible Framework for Data Pattern Exploration
var_grid

Create a tibble of combinations of selected column names
reexports

Objects exported from other packages
partition

Convert columns of a data frame to Boolean or fuzzy sets (triangular, trapezoidal, or raised-cosine)
var_names

Extract variable names from predicate names
which_antichain

Return indices of first elements of the list, which are incomparable with preceding elements.