2.1 Why R?

As mentioned in the previous chapter, simulation is very often applied in many areas, for instance management science and engineering. Often a simulation is carried out using an Excel spreadsheet or using a specialised software whose only purpose is creating simulations. Historically, R has not been at the forefront of the implementation of simulation models, in particular of discrete-event simulations. Only recently, R packages implementing discrete-event simulation have appeared, most importantly the simmer R package that you will learn using in later chapters.

These notes are intended to provide a unique view of simulation with specific implementation in the R programming language. Some of the strenght of R are:

  • it is free, open-source and available in all major operating systems;

  • the community of R users is huge, with many forums, sites and resources that give you practical support in developing your own code;

  • a massive set of add-on packages to increase the capabilities of the basic R environment;

  • functions to perform state-of-the-art statistical and machine-learning methods. Researchers sometimes create an associated R package to any article they publish so for others to use their methods;

  • the integrated development environment RStudio provides a user-friendly environment to make the R programming experience more pleasing;

  • powerful communication tools to create documents and presentations embedding R code and R output. As a matter of fact this very book is created in R!!!!