ABSTRACT

This chapter provides a starting point for using R for discrete mathematical ideas. It provides examples of combinatorics, number theory, set theory, and graph theory. The chapter constructs the first dozen iterations of the Cantor set and estimates a random graph question with a simulation. There are a few packages that create Venn diagrams. The chapter uses the eulerr package, which creates area-proportional Venn diagrams. The only limitation on the number of sets in the Venn diagram is computing power and the visual usefulness of the diagram. The chapter also describes how to construct some standard graphs using the igraph packag while illustrating some of the options for displaying graphs.