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 the Exercise – Correlations section:
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 cor now only receives one variable. |
Error in cor(.arg1): supply both 'x' and 'y' or a matrix-like 'x' |
Adjusted code throws this error. |
It's certainly no surprise that R would throw an error in this case. The cor function requires two variables, but the adjusted code only provides one. As stated in the returned error message, a second variable is required.
Be...