```
SCRIPT_REAL('mydata <- data.frame(Rep=.arg1, survey=.arg2, diffc=.arg3);
lrmodel <- glm(Rep ~ survey + diffc, data = mydata, family = "binomial");
prob <- predict(lrmodel, newdata = mydata, type = "response")',
AVG([Republican]),AVG([SurveyUSA]),AVG([Diff Count]))
```

We can integrate R and Tableau for text data mining in social media analysis, big data analytics, machine learning, predictive modeling, statistical modeling, etc., by taking advantage of the numerous R packages. Then, using Tableau will be painless for generating amazing visualizations.

In the dashboard below, the figure at the top is probability of a Republican party winning as predicted from a logistic regression. we can take probabilities greater than 0.50 as success (Republican) and probability values of 0.5 and below as Democrat. The figure at the bottom shows actual elections. As we can clearly observe from the dashboard, the model has a very good performance.