tuple               package:relations               R Documentation

_T_u_p_l_e_s

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

     Creation and manipulation of tuples.

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

     tuple(...)
     as.tuple(x)
     is.tuple(x)
     singleton(...)
     pair(...)
     triple(...)
     tuple_is_singleton(x)
     tuple_is_pair(x)
     tuple_is_triple(x)
     tuple_is_ntuple(x, n)

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

       x: An R object.

       n: A non-negative integer.

     ...: Possibly named R objects (for 'pair' and 'triple' exactly two
          and three, respectively.)

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

     These functions represent basic infrastructure for handling tuples
     of general (R) objects.  Class 'tuple' is used in particular to
     correctly handle cartesian products of sets.  Although tuple
     objects should behave like "ordinary" vectors, some operations
     might yield unexpected results since tuple objects are in fact
     list objects internally. The 'Summary' methods do work if defined
     for the set elements. The 'mean' and 'median' methods try to
     convert the object to a numeric vector before calling the default
     methods.

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

     'set' and 'relation'.

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

     ## Constructor.
     tuple(1,2,3, TRUE)
     triple(1,2,3)
     pair(Name = "David", Height = 185)
     tuple_is_triple(triple(1,2,3))
     tuple_is_ntuple(tuple(1,2,3,4), 4)

     ## Converter.
     as.tuple(1:3)

     ## Operations.
     c(tuple("a","b"), 1)
     tuple(1,2,3) * tuple(2,3,4)
     rep(tuple(1,2,3), 2)
     min(tuple(1,2,3))
     sum(tuple(1,2,3))

