transactions-class          package:arules          R Documentation

_C_l_a_s_s "_t_r_a_n_s_a_c_t_i_o_n_s" - _B_i_n_a_r_y _I_n_c_i_d_e_n_c_e _M_a_t_r_i_x _f_o_r
_T_r_a_n_s_a_c_t_i_o_n_s

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

     The 'transactions' class represents transaction data used for
     mining itemsets or rules.  It is a direct extension of class
     'itemMatrix' to store a binary incidence matrix, item labels, and
     optionally transaction IDs and user IDs.

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

     Objects are created by coercion from objects of other classes or
     by calls of the form 'new("transactions", ...)'.

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

     '_t_r_a_n_s_a_c_t_i_o_n_I_n_f_o': object of class '"data.frame"' with vectors of
          the same length as the number of transactions.  Each vector
          can hold additional information, e.g., store transaction IDs
          or user IDs for each transaction.

     '_d_a_t_a': object of class 'dgCMatrix' to store the binary incidence
          matrix (see 'itemMatrix' class) 

     '_i_t_e_m_I_n_f_o': object of class '"data.frame"' to store  item labels
          (see 'itemMatrix' class)

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

     Class 'itemMatrix', directly.

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

     [ 'signature(x = "transactions")'; extracts a subset from the
          incidence matrix.  The first argument extracts transactions
          and the second argument can be used to extract a subset of
          items (using item IDs)

     _c_o_e_r_c_e 'signature(from = "matrix", to = "transactions")'; produces
          a transactions data set from a binary incidence matrix.  The
          row names are used as item labels and the column names are
          stores as transaction IDs.

     _c_o_e_r_c_e 'signature(from = "list", to = "transactions")'; produces a
          transactions data set from a list.  The names of the items in
          the list are used as item labels and the item IDs and the 
          incidence matrix is produced automatically.

     _c_o_e_r_c_e 'signature(from = "transactions", to = "matrix")'

     _c_o_e_r_c_e 'signature(from = "transactions", to = "list")'

     _c_o_e_r_c_e 'signature(from = "data.frame", to = "transactions")'; 
          recodes the data frame containing only categorical variables
          (all have to be factors) into a binary transaction data set. 
          The needed number of dummy items are automatically generated.
           The item labels are generated by concatenating variable
          names and levels with a '"="'.    The variable names and
          levels are stored in the labels data frame as the components
          'variables' and 'levels'.

     _i_m_a_g_e 'signature(x = "transactions")'; plots an image of the
          transactions for visual inspection

     _l_a_b_e_l_s 'signature(x = "transactions")'; returns the labels (item
          labels and transaction IDs)  for the incidence matrix as a
          list of two vectors named 'items' and 'transactionIDs'.

     _t_r_a_n_s_a_c_t_i_o_n_I_n_f_o<- 'signature(x = "transactions")'; replaces the
          transactionInfo data frame

     _t_r_a_n_s_a_c_t_i_o_n_I_n_f_o 'signature(x = "transactions")'; returns
          transactionInfo

     _s_h_o_w 'signature(object = "transactions")'

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

_A_u_t_h_o_r(_s):

     Michael Hahsler

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

     'itemMatrix-class'

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

     data <- list(
           c("a","b","c"),
           c("a","b"),
           c("a","b","d"),
           c("c","e"),
           c("a","b","d","e"),
           )

     names(data) <- paste("Tr",c(1:5), sep = "")

     ### coerce data into transactins
     trans <- as(data, "transactions")

     ### analyze transactions
     summary(trans)
     image(trans)

