Find outliers in data using R in tableau

0 votes
How to find outliers in data using R in tableau? Can someone help?
Jun 19, 2019 in Tableau by Nithin
2,310 views

1 answer to this question.

0 votes

Hi Nithin,

Follow the below steps:

1. Connect to Rserve from Tableau, To learn about connecting R and Tableau visit here.

https://www.edureka.co/community/49518/setup-r-in-tableau

Then install mvoutlier after setting Rserve() in R to use mvoutlier by writing below command.

install.packages("mvoutlier")

2. Create a chart as per requirement.

 For example - I want to show the months that are outliers throughout a year.

3. Then Create a calculative field as below

Explanation to the calculative field - 

  • SCRIPT_REAL(string, expression)  Here string is the External commands and statements for operations such as clustering, forecast, etc. and expression is the tableau fields and aggregated fields needed for operation. To find the outliers in sum(sales), tableau needs to send data points SUM([Sales]) which are received by external variable using .arg1 for R, _arg1 for python.
  • Multiple statements within an expression are separated using ; (semicolon).
  • SCRIPT_REAL()  >  where REAL indicates the data type of data that is passed to an external source such as Python or R. Other options are  INT, BOOL, STR.
  • Library(mvoutlier)  mvoutlier is a package that consists of all functions and modules required. It detects multivariate outliers based on Mahalanobis distance and adjusted Mahalanobis distance. The line means that the operation needs mvoutlier package.
  • sign2() is a fast algorithm for identifying multivariate outliers in high-dimensional and/or large datasets, using spatial signs. The computation of the distances is based on principal components.
  • cbind() is an R function that takes several column vectors as arguments, separated by commas, and combines them into a "data frame", which outside of R means a table or matrix.
  •  cbind(.arg1) is used to create a data frame $var01 from the list of Sum([Profit]) for all points that are present in the visual. 
  • .arg1 indicates an argument which is fetched in the second half of the function. multiple arguments can be given  by writing .arg2, .arg3, etc and values given followed by SUM([Sales]),SUM([Profit]),etc.

4. Drop the field in color shelf to see the outliers like below

Hope it helps!

answered Jun 20, 2019 by Cherukuri
• 33,030 points

Related Questions In Tableau

0 votes
1 answer

How can I calculate the median of sales price using 3 variables in Tableau

First let me clarify things for you. ...READ MORE

answered Apr 12, 2018 in Tableau by xyz
• 1,560 points
7,020 views
0 votes
1 answer

How to refresh the extracted data source automatically in Tableau Desktop?

Hi AwesomeSauce, This comes up every so often!  Tableau ...READ MORE

answered Aug 14, 2018 in Tableau by Naruto
• 710 points
4,646 views
0 votes
1 answer

Using Regex in Tableau, but only getting Null values.

Tableau regex engine is ICU, and there ...READ MORE

answered Aug 17, 2018 in Tableau by AwesomeSauce
• 860 points
911 views
0 votes
0 answers

pre-requisites to learn Tableau and R

What are the pre-requisites to learn Tableau ...READ MORE

May 10, 2018 in Tableau by GandalfDwhite
• 1,320 points
475 views
0 votes
1 answer

Setup R in Tableau

Follow the below steps: 1. Install R studio from ...READ MORE

answered Jun 20, 2019 in Tableau by Cherukuri
• 33,030 points
812 views
0 votes
1 answer

Error: package or namespace load failed for ‘mvoutlier’

Hi Sindhu, The error tells that JAGS .exe ...READ MORE

answered Jun 20, 2019 in Tableau by Cherukuri
• 33,030 points
1,214 views
0 votes
1 answer

Clustering using R and Tableau

Let me explain with a simple explanation ...READ MORE

answered Jun 20, 2019 in Tableau by Cherukuri
• 33,030 points
1,677 views
0 votes
1 answer

Forecast using R in Tableau

Let me explain using example forecast of profit ...READ MORE

answered Jun 21, 2019 in Tableau by Cherukuri
• 33,030 points
1,914 views
0 votes
1 answer
webinar REGISTER FOR FREE WEBINAR X
REGISTER NOW
webinar_success Thank you for registering Join Edureka Meetup community for 100+ Free Webinars each month JOIN MEETUP GROUP