### **Requirements:**

- Tableau Professional Edition
- R Studio or R Console

### **Setting Up Tableau Desktop with R:**

Install following packages in R:

```r
install.packages(RServe)
```

Once it is installed then start R Server by entering following command in the console:

```r
> library(RServe)
> RServe()
```

### **Configuring** Rserve **Connection:**

In Tableau go to following menu setting: **Help -> Settings and Performance -> Manage External Service Connection**

Enter or select a server name using a domain or an IP address. On a personal laptop or computer, you can enter **localhost.** The drop-down list includes localhost and the server you most recently connected to.

Specify a port. **Port 6311** is the default port for Rserve servers.

If the server requires credentials, specify a Username and Password.

Click **Test Connection**.

Click **OK**.

### Executing R Script from Tableau:

Create a new calculated field and name it as **Coefficient,** which will calculate the coefficient for the linear regression model.

Then drag and drop your calculated variable to play around with visualisations.

Tableau and R Integration final output of a linear regression model

To learn more visit: [Tableau](https://www.tableau.com/learn/tutorials/on-demand/how-integrate-r-and-tableau)
