Search icon
Arrow left icon
All Products
Best Sellers
New Releases
Books
Videos
Audiobooks
Learning Hub
Newsletters
Free Learning
Arrow right icon
Advanced Analytics with R and Tableau

You're reading from  Advanced Analytics with R and Tableau

Product type Book
Published in Aug 2017
Publisher Packt
ISBN-13 9781786460110
Pages 178 pages
Edition 1st Edition
Languages
Authors (3):
Ruben Oliva Ramos Ruben Oliva Ramos
Profile icon Ruben Oliva Ramos
Jen Stirrup Jen Stirrup
Profile icon Jen Stirrup
Roberto Rösler Roberto Rösler
View More author details

Table of Contents (16) Chapters

Advanced Analytics with R and Tableau
Credits
About the Authors
About the Reviewers
www.PacktPub.com
Customer Feedback
Preface
1. Advanced Analytics with R and Tableau 2. The Power of R 3. A Methodology for Advanced Analytics Using Tableau and R 4. Prediction with R and Tableau Using Regression 5. Classifying Data with Tableau 6. Advanced Analytics Using Clustering 7. Advanced Analytics with Unsupervised Learning 8. Interpreting Your Results for Your Audience 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.

More information about control flows can be obtained by executing the command at the command line:

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...

lock icon The rest of the chapter is locked
Register for a free Packt account to unlock a world of extra content!
A free Packt account unlocks extra newsletters, articles, discounted offers, and much more. Start advancing your knowledge today.
Unlock this book and the full library FREE for 7 days
Get unlimited access to 7000+ expert-authored eBooks and videos courses covering every tech area you can think of
Renews at AU $19.99/month. Cancel anytime}