#### Overview of this book

Tableau and R offer accessible analytics by allowing a combination of easy-to-use data visualization along with industry-standard, robust statistical computation. Moving from data visualization into deeper, more advanced analytics? This book will intensify data skills for data viz-savvy users who want to move into analytics and data science in order to enhance their businesses by harnessing the analytical power of R and the stunning visualization capabilities of Tableau. Readers will come across a wide range of machine learning algorithms and learn how descriptive, prescriptive, predictive, and visually appealing analytical solutions can be designed with R and Tableau. In order to maximize learning, hands-on examples will ease the transition from being a data-savvy user to a data analyst using sound statistical tools to perform advanced analytics. By the end of this book, you will get to grips with advanced calculations in R and Tableau for analytics and prediction with the help of use cases and hands-on examples.
Advanced Analytics with R and Tableau
Credits
www.PacktPub.com
Customer Feedback
Preface
Free Chapter
Advanced Analytics with R and Tableau
The Power of R
A Methodology for Advanced Analytics Using Tableau and R
Prediction with R and Tableau Using Regression
Classifying Data with Tableau
Index

## For loops and vectorization in R

Specifically, we will look at the constructs involved in loops. Note, however, that it is more efficient to use vectorized operations rather than loops, because R is vector-based. We investigate loops here, because they are a good first step in understanding how R works, and then we can optimize this understanding by focusing on vectorized alternatives that are more efficient.

```Help?Control
```

The control flow commands take decisions and make decisions between alternative actions. The main constructs are for, while, and repeat.

### For loops

Let's look at a `for` loop in more detail. For this exercise, we will use the `Fisher iris` dataset, which is installed along with R by default. We are going to produce summary statistics for each species of iris in the dataset.

You can see some of the iris data by typing in the following command at the command prompt:

```head(iris)
```

We can...