Troubleshooting
The interaction between Tableau and R can be challenging to negotiate. You may experience numerous problems that at first seem difficult to understand. These problems, however, usually stem from a few underlying causes. This section will address some of those underlying causes.
Give R what it expects
It's important to make sure that the variables you pass to an R argument line up with what R is expecting. Consider the following example based on code from Exercise - correlation:
SCRIPT_REAL("cor(.arg1, .arg2)", SUM([Sales]), SUM([Profit]))
|
Initial code from Exercise 2 |
script_real("cor(.arg1)", SUM([Sales]), SUM([Profit]))
|
Adjusted code from Exercise 2. Note that |
Error in cor(.arg1): supply both 'x' and 'y' or a matrix-like 'x'
|
The adjusted code throws this error. |
It's certainly no surprise that R would throw an error in this case. The cor
function requires...