Skip to contents

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

Author

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

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}