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 2023

You're reading from   Mastering Tableau 2023 Implement advanced business intelligence techniques, analytics, and machine learning models with Tableau

Arrow left icon
Product type Paperback
Published in Aug 2023
Publisher Packt
ISBN-13 9781803233765
Length 684 pages
Edition 4th Edition
Languages
Tools
Arrow right icon
Author (1):
Arrow left icon
Marleen Meier Marleen Meier
Author Profile Icon Marleen Meier
Marleen Meier
Arrow right icon
View More author details
Toc

Table of Contents (19) Chapters Close

Preface 1. Reviewing the Basics 2. Getting Your Data Ready FREE CHAPTER 3. Using Tableau Prep Builder 4. Learning about Joins, Blends, and Data Structures 5. Introducing Table Calculations 6. Utilizing OData, Data Densification, Big Data, and Google BigQuery 7. Practicing Level of Detail Calculations 8. Going Beyond the Basics 9. Working with Maps 10. Presenting with Tableau 11. Designing Dashboards and Best Practices for Visualizations 12. Leveraging Advanced Analytics 13. Improving Performance 14. Exploring Tableau Server and Tableau Cloud 15. Integrating Programming Languages 16. Developing Data Governance Practices 17. Other Books You May Enjoy
18. Index

Implementing R functionality

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 the class of functions beginning with SCRIPT_, as shown in the following screenshot:

Figure 15.8: SCRIPT_ 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 true or false values, and so forth.

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

Figure 15.9: R script syntax

The preceding example code calculates the average profit, but we will get to more examples in the next sections. Let’s start by reproducing Tableau functionality using the R integration and hence prove that R is working properly.

Reproducing native Tableau functionality in R

For our first exercise, we will use the AVG,...

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 €18.99/month. Cancel anytime