Search icon CANCEL
Arrow left icon
Explore Products
Best Sellers
New Releases
Books
Videos
Audiobooks
Learning Hub
Conferences
Free Learning
Arrow right icon
Arrow up icon
GO TO TOP
Mastering Tableau

You're reading from   Mastering Tableau Smart Business Intelligence techniques to get maximum insights from your data

Arrow left icon
Product type Paperback
Published in Dec 2016
Publisher Packt
ISBN-13 9781784397692
Length 476 pages
Edition 1st Edition
Languages
Tools
Arrow right icon
Authors (2):
Arrow left icon
Jen Stirrup Jen Stirrup
Author Profile Icon Jen Stirrup
Jen Stirrup
David Baldwin David Baldwin
Author Profile Icon David Baldwin
David Baldwin
Arrow right icon
View More author details
Toc

Table of Contents (14) Chapters Close

Preface 1. Getting Up to Speed – a Review of the Basics FREE CHAPTER 2. All about Data – Getting Your Data Ready 3. All about Data – Joins, Blends, and Data Structures 4. All about Data – Data Densification, Cubes, and Big Data 5. Table Calculations 6. Level of Detail Calculations 7. Beyond the Basic Chart Types 8. Mapping 9. Tableau for Presentations 10. Visualization Best Practices and Dashboard Design 11. Improving Performance 12. Interacting with Tableau Server 13. R Integration

Using R functions

Now that we have successfully connected Tableau with R, let's write some code in Tableau to invoke R. Within Tableau, open the Calculated Field Editor. Notice within the functions panel those entries beginning with SCRIPT_, as shown in the following image:

Using R functions

The SCRIPT functions are used by Tableau to invoke R. The function names communicate the data type of the returned results: SCRIPT_REAL returns float values, SCRIPT_BOOL returns T|F values, and so on.

The syntax of a SCRIPT function is represented in the following diagram:

Using R functions

Exercise - reproducing native Tableau functionality in R

For our first example, we will use the AVG, MEDIAN, and STDEV functions in Tableau and compare the results with the mean, median, and sd R functions. This will allow you to practice the SCRIPT functions, begin to understand R syntax, and compare results generated by Tableau with those generated by R:

  1. Navigate to https://public.tableau.com/profile/david.baldwin#!/ to locate and download...
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 £16.99/month. Cancel anytime