inspectDT: Inspect Associations Interactively Using datatable

View source: R/inspectDT.R

inspectDTR Documentation

Inspect Associations Interactively Using datatable

Description

Uses datatable to create a HTML table widget using the DataTables library. Rules can be interactively filtered and sorted.

Usage

inspectDT(x, ...)

## Default S3 method:
inspectDT(x, ...)

## S3 method for class 'rules'
inspectDT(x, precision = 3, ...)

## S3 method for class 'itemsets'
inspectDT(x, precision = 3, ...)

## S3 method for class 'data.frame'
inspectDT(x, precision = 3, ...)

Arguments

x

an object of class "rules" or "itemsets".

...

additional arguments are passed on to DT::datatable().

precision

controls the precision used to print the quality measures (defaults to 2).

Value

A datatable htmlwidget.

Author(s)

Michael Hahsler

References

Hahsler M (2017). arulesViz: Interactive Visualization of Association Rules with R. R Journal, 9(2):163-175. ISSN 2073-4859. \Sexpr[results=rd]{tools:::Rd_expr_doi("10.32614/RJ-2017-047")}.

See Also

datatable in DT.

Examples


## Not run: 
data(Groceries)
rules <- apriori(Groceries, parameter=list(support=0.005, confidence=0.5))
rules

inspectDT(rules)

# for more control on the data table, you can used DATAFRAME() to convert the rules.
rules_df <- DATAFRAME(rules, setStart = '', setEnd = '', itemSep = ' + ')
rules_df$count <- NULL
head(rules_df)
inspectDT(rules_df)

# Save HTML widget as web page
p <- inspectDT(rules)
htmlwidgets::saveWidget(p, "arules.html", selfcontained = FALSE)
# Note: self-contained seems to make the browser slow.

# inspect the widget
browseURL("arules.html")

# clean up
unlink(c("arules.html", "arules_files"), recursive = TRUE)
## End(Not run)


mhahsler/arulesViz documentation built on Sept. 10, 2023, 4:16 a.m.