Abbreviate item labels in transactions, itemMatrix and associations
Source:R/abbreviate.R
abbreviate.RdProvides the generic function and the methods to abbreviate long item labels
in transactions, associations (rules and itemsets) and transaction ID lists.
Note that abbreviate() is not a generic and this arules defines a
generic with the base::abbreviate() as the default.
Usage
abbreviate(names.arg, ...)
# S4 method for class 'itemMatrix'
abbreviate(names.arg, minlength = 4, ..., method = "both.sides")
# S4 method for class 'transactions'
abbreviate(names.arg, minlength = 4, ..., method = "both.sides")
# S4 method for class 'rules'
abbreviate(names.arg, minlength = 4, ..., method = "both.sides")
# S4 method for class 'itemsets'
abbreviate(names.arg, minlength = 4, ..., method = "both.sides")
# S4 method for class 'tidLists'
abbreviate(names.arg, minlength = 4, ..., method = "both.sides")Arguments
- names.arg
an object of class transactions, itemMatrix, itemsets, rules or tidLists.
- ...
further arguments passed on to the default abbreviation function.
- minlength
number of characters allowed in abbreviation
- method
apply to level and value (both.sides)
See also
Other associations functions:
associations-class,
c,
duplicated(),
extract,
inspect(),
is.closed(),
is.generator(),
is.maximal(),
is.redundant(),
is.significant(),
is.superset(),
itemsets-class,
match(),
rules-class,
sample(),
sets,
size(),
sort(),
unique()
Other itemMatrix and transactions functions:
c,
crossTable(),
duplicated(),
extract,
hierarchy,
image,
inspect(),
is.superset(),
itemFrequency(),
itemFrequencyPlot(),
itemMatrix-class,
itemwiseSetOps,
match(),
merge(),
random.transactions(),
sample(),
sets,
size(),
supportingTransactions(),
tidLists-class,
transactions-class,
unique()
Examples
data(Adult)
inspect(head(Adult, 1))
#> items transactionID
#> [1] {age=Middle-aged,
#> workclass=State-gov,
#> education=Bachelors,
#> marital-status=Never-married,
#> occupation=Adm-clerical,
#> relationship=Not-in-family,
#> race=White,
#> sex=Male,
#> capital-gain=Low,
#> capital-loss=None,
#> hours-per-week=Full-time,
#> native-country=United-States,
#> income=small} 1
Adult_abbr <- abbreviate(Adult, 15)
inspect(head(Adult_abbr, 1))
#> items
#> [1] {age=Middle-aged,
#> workclss=Stt-gv,
#> educatin=Bchlrs,
#> mrtl-stts=Nvr-m,
#> occptn=Adm-clrc,
#> rltnshp=Nt-n-fm,
#> race=White,
#> sex=Male,
#> capital-gain=Lw,
#> capital-loss=Nn,
#> hrs-pr-wk=Fll-t,
#> ntv-cntry=Unt-S,
#> income=small}