classes              package:relations              R Documentation

_R_e_l_a_t_i_o_n _E_q_u_i_v_a_l_e_n_c_e _C_l_a_s_s_e_s

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

     Provide class ids (classes) for an equivalence relation, or the
     indifference relation of a weak order.

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

     relation_class_ids(x)
     relation_classes(x)

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

       x: an object inheriting from class 'relation'.

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

     For 'relation_class_ids', a numeric vector with class ids
     corresponding to the classes of the equivalence relation, or the
     indifference relation of the weak order with ids ordered according
     to increasing preference. For 'relation_classes', an object of
     class '"relation_classes_of_objects"', which is a named list of
     character vectors, where the list components correspond to the
     classes, the component names to the class ids, and each character
     vector to the object labels of each class.

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

     ## Equivalence.
     f <- factor(rep(c("Good", "Bad", "Ugly"), c(3, 2, 1)))
     R <- as.relation(f)
     relation_is_equivalence(R)
     table(ids = relation_class_ids(R), orig = f)

     relation_classes(R)

     ## Weak order ("weak preference").
     f <- ordered(f, levels = c("Ugly", "Bad", "Good"))
     R <- as.relation(f)
     relation_is_weak_order(R)
     table(ids = relation_class_ids(R), orig = f)

     relation_classes(R)

