abbreviate: Abbreviate function for item labels in transactions,...

Description Usage Arguments Author(s) See Also Examples

Description

Provides 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 R's abbreviate as the default.

Usage

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
abbreviate(names.arg, ...)
## S4 method for signature 'itemMatrix'
abbreviate(names.arg, minlength = 4, ..., method = "both.sides")
## S4 method for signature 'rules'
abbreviate(names.arg, minlength = 4, ..., method = "both.sides")
## S4 method for signature 'itemsets'
abbreviate(names.arg, minlength = 4, ..., method = "both.sides")
## S4 method for signature 'transactions'
abbreviate(names.arg, minlength = 4, ..., method = "both.sides")
## S4 method for signature 'tidLists'
abbreviate(names.arg, minlength = 4, ..., method = "both.sides")

Arguments

names.arg

an object of class "transactions", "itemMatrix", "itemsets", "rules" or "tidLists".

minlength

number of characters allowed in abbreviation

method

apply to level and value (both.sides)

...

further arguments passed on to the default abbreviation function.

Author(s)

Sudheer Chelluboina and Michael Hahsler based on code by Martin Vodenicharov.

See Also

abbreviate in base.

Examples

1
2
3
4
5
data(Adult)
inspect(head(Adult, 1))

Adult_abbr <- abbreviate(Adult, 15)
inspect(head(Adult_abbr, 1))

Example output

Loading required package: Matrix

Attaching package: 'arules'

The following objects are masked from 'package:base':

    abbreviate, write

    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
    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}   

arules documentation built on Aug. 29, 2019, 9:03 a.m.