rules-class              package:arules              R Documentation

_C_l_a_s_s "_r_u_l_e_s" - _A _S_e_t _o_f _R_u_l_e_s

_D_e_s_c_r_i_p_t_i_o_n:

     The 'rules' class represents a set of rules.

     Note that the class can also contain a collection of rules with
     duplicated elements. Duplicated elements can be removed with
     'unique'.

_O_b_j_e_c_t_s _f_r_o_m _t_h_e _C_l_a_s_s:

     Objects are the result of calling the function 'apriori'. Objects
     can also be created by calls of the form 'new("rules", ...)'.

_S_l_o_t_s:

     '_l_h_s': Object of class 'itemMatrix';  the left-hand-sides of the
          rules (antecedents)

     '_r_h_s': Object of class 'itemMatrix'; the right-hand-sides of the
          rules (consequents) 

     '_q_u_a_l_i_t_y': a data.frame

_E_x_t_e_n_d_s:

     Class 'associations', directly.

_M_e_t_h_o_d_s:

     _c_o_e_r_c_e 'signature(from = "rules", to = "data.frame")';  represents
          the set of rules as a 'data.frame'

     _i_t_e_m_I_n_f_o 'signature(object = "rules")';   returns the whole item
          information data frame including item labels

     _i_t_e_m_L_a_b_e_l_s 'signature(object = "rules")'; returns the item labels
          used to encode the rules

     _i_t_e_m_s 'signature(x = "rules")'; returns for each rule the union of
          the items in the  lhs and rhs (i.e., the itemsets which
          generated the rule) as an  'itemMatrix'

     _g_e_n_e_r_a_t_i_n_g_I_t_e_m_s_e_t_s 'signature(x = "rules")'; returns a collection
          of the itemsets which generated the rules (one  itemset for
          each rule). Note that the collection can contain duplicated
          elements. Use 'unique' to remove duplicates and obtain a 
          proper set.  

     _l_a_b_e_l_s 'signature(object = "rules")'; returns labels for the rules
          ("{lhs} => {rhs}") as a 'character' vector. The
          representation can be customized using  the additional
          parameter 'ruleSep' and parameters for 'label' defined in
          'itemMatrix' 

     _i_t_e_m_L_a_b_e_l_s 'signature(object = "rules")'; returns the item labels
          as a character vector. The index for each lable is the column
          index of the item in the binary matrix.

     _l_h_s 'signature(x = "rules")'; returns the 'itemMatrix'
          representing the left-hand-side of the rules (antecedents)

     _l_h_s<- 'signature(x = "rules")'; replaces the 'itemMatrix'
          representing the left-hand-side of the rules (antecedents)

     _r_h_s 'signature(x = "rules")'; returns the 'itemMatrix'
          representing the right-hand-side of the rules (consequents)

     _r_h_s<- 'signature(x = "rules")'; replaces the 'itemMatrix'
          representing the right-hand-side of the rules (consequents)

     _s_u_m_m_a_r_y 'signature(object = "rules")'

_S_e_e _A_l_s_o:

     '[-methods', 'apriori', 'c', 'duplicated', 'inspect', 'length',
     'match', 'sets', 'size', 'subset', 'associations-class',
     'itemMatrix-class',

_E_x_a_m_p_l_e_s:

     data("Adult")

     ## Mine rules.
     rules <- apriori(Adult, parameter = list(support = 0.4))

     ## Select a subset of rules using partial matching on the items 
     ## in the right-hand-side and a quality measure
     rules.sub <- subset(rules, subset = rhs %pin% "sex" & lift > 1.3)

     ## Display rules.
     inspect(SORT(rules.sub)[1:3])

