match                 package:arules                 R Documentation

_V_a_l_u_e _M_a_t_c_h_i_n_g

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

     Provides the generic function 'match'  and the S4 methods for
     associations and transactions.  'match' returns a vector of the
     positions of (first) matches of its first argument in its second.

     '%in%' is a more intuitive interface as a binary operator, which
     returns a logical vector indicating if there is a match or not for
     its left operand.

_U_s_a_g_e:

     match(x,  table, nomatch = NA, incomparables = FALSE)

     x %in% table

_A_r_g_u_m_e_n_t_s:

       x: an object of class 'itemMatrix', 'transactions' or 
          'associations'.

   table: a set of associations or transactions to be matched against. 

 nomatch: the value to be returned in the case when no match is found. 

incomparables: not implemented. 

_V_a_l_u_e:

     'match': An integer vector of the same length as 'x'  giving the
     position in 'table' of the first match if there is a match,
     otherwise 'nomatch'.

     '%in%':  A logical vector, indicating if a match was located for
     each element of 'x'.

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

     'rules-class', 'itemsets-class', 'itemMatrix-class'

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

     data("Adult")

     ## get unique transactions, count frequency of unique transactions 
     ## and plot frequency of unique transactions
     vals <- unique(Adult)
     cnts <- tabulate(match(Adult, vals))
     plot(sort(cnts, decreasing=TRUE))

     ## find all transactions which are equal to transaction 10 in Adult
     which(Adult %in% Adult[10])

