| nugget | R Documentation |
Construct a nugget object, which is an S3 object used to store and
represent results (e.g., rules or patterns) in the nuggets framework.
nugget(x, flavour, call_function, call_data, call_args)
x |
An object with rules or patterns, typically a tibble or data frame.
If |
flavour |
A character string specifying the flavour of the nugget, or
|
call_function |
A character scalar giving the name of the function that created the nugget. Stored as an attribute for provenance. |
call_data |
A list containing information about the data that was passed to the function which created the nugget. Stored as an attribute for reproducibility. |
call_args |
A list of arguments that were passed to the function which created the nugget. Stored as an attribute for reproducibility. |
A nugget is technically a tibble (or data frame) that inherits from both
the "nugget" class and, optionally, a flavour-specific S3 class. This
allows distinguishing different types of nuggets (flavours) while still
supporting generic methods for all nuggets.
Each nugget stores additional provenance information in attributes:
"call_function" — the name of the function that created the nugget.
"call_args" — the list of arguments passed to that function.
These attributes make it possible to reconstruct or track how the nugget
was created, which supports reproducibility, transparency, and debugging.
For example, one can inspect attr(n, "call_args") to recover the original
parameters used to mine the patterns.
A tibble object that is an S3 subclass of "nugget" and, if
specified, the given flavour class. The object also contains attributes
"call_function" and "call_args" describing its provenance.
Michal Burda
is_nugget()
df <- data.frame(lhs = c("a", "b"), rhs = c("c", "d"))
n <- nugget(df,
flavour = "rules",
call_function = "example_function",
call_data = list(ncol = 2,
nrow = 2,
colnames = c("lhs", "rhs")),
call_args = list(data = "mydata"))
inherits(n, "nugget") # TRUE
inherits(n, "rules") # TRUE
attr(n, "call_function") # "dig_example_function"
attr(n, "call_args") # list(data = "mydata")
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.