Sets with R: Building the Tools
This chapter addresses fundamental concepts in mathematics and discusses how they can be implemented in R. It briefly reviews the basic concepts relating to sets and then for each concept practice R skill by implementing that concept with R. The chapter distinguishes between what is done in mathematics, what is done in logic, and what is done in programming. Venn diagrams are used to denote relationships between sets. In most cases, the term cardinality is just a fancy word to mean the number of elements in a set. In mathematics, by definition, a set cannot have repeated elements. The cross product of two sets is an important concept in discrete math. A set with no elements is called an empty set.