Last chance! 50% off unlimited learning
Sale ends in
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)
pair
and
triple
exactly two and three, respectively.)tuple
is used in particular to
correctly handle cartesian products of sets. Although tuple objects
should behave like 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.set
and relation
.## 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))
Run the code above in your browser using DataLab