Learn R Programming

nuggets (version 2.1.2)

is_nugget: Test whether an object is a nugget

Description

Check if the given object is a nugget, i.e. an object created by nugget(). If a flavour is specified, the function returns TRUE only if the object is a nugget of the given flavour.

Technically, nuggets are implemented as S3 objects. An object is considered a nugget if it inherits from the S3 class "nugget". It is a nugget of a given flavour if it inherits from both the specified flavour class and the "nugget" class.

Usage

is_nugget(x, flavour = NULL)

Value

A logical scalar: TRUE if x is a nugget (and of the specified flavour, if given), otherwise FALSE.

Arguments

x

An object to be tested.

flavour

Optional character string specifying the required flavour of the nugget. If NULL (default), the function checks only whether x is a nugget of any flavour.

Author

Michal Burda

See Also

nugget()

Examples

Run this code
d <- partition(mtcars, .breaks = 2)
rules <- dig_associations(d, min_support = 0.3)
is_nugget(rules)
is_nugget(rules, "associations")
is_nugget(mtcars)

Run the code above in your browser using DataLab