makeIntersectList          package:plotrix          R Documentation

_C_o_u_n_t _s_e_t _i_n_t_e_r_s_e_c_t_i_o_n_s

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

     Create a list of set intersections from a matrix of indicators.

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

      makeIntersectList(x,xnames=NULL)

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

       x: A data frame or matrix where rows represent objects and
          columns attributes. A '1' or 'TRUE' indicates that the object
          (row) has that attribute or is a member of that set (column).

  xnames: Optional user-supplied names for the categories of x.

_D_e_t_a_i_l_s:

     'makeIntersectList' reads a matrix (or data frame) containing only
     dichotomous values (either 0/1 or FALSE/TRUE). Each row represents
     an object and each column represents a set. A value of 1 or TRUE
     indicates that that object is a member of that set. The function
     creates a list of vectors that correspond to all combinations of
     the sets (set intersections) and inserts the counts of elements in
     each combination. If a row of the matrix is all zeros, it will not
     be counted, but the last element of the list returned contains the
     count of rows in 'x' and thus non-members can be calculated.

     makeIntersectList combines the set or attribute names to form
     intersection names. For the intersection of sets A and B, the name
     will be AB and so on. These are the names that will be displayed
     by intersectDiagram. To change these, use the 'xnames' argument.

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

     A list of the intersection counts or percentages and the total
     number of objects.

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

     Jim Lemon

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

     'intersectDiagram', 'pasteCols'

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

      # create a matrix where each row represents an element and
      # a 1 (or TRUE) in each column indicates that the element is a member
      # of that set.
      setdf<-data.frame(A=sample(c(0,1),100,TRUE,prob=c(0.7,0.3)),
       B=sample(c(0,1),100,TRUE,prob=c(0.7,0.3)),
       C=sample(c(0,1),100,TRUE,prob=c(0.7,0.3)),
       D=sample(c(0,1),100,TRUE,prob=c(0.7,0.3)))
      setdflist<-makeIntersectList(setdf)
      setdflist

