KNOWLEDGE BASE

Error "expected closing parenthesis or comma when parsing argument list" Passing R Code With Strings Gives


Published: 22 Jul 2014
Last Modified Date: 02 Sep 2016

Issue

When using SCRIPT_* functions in R, an error similar to the following might occur:

expected closing parenthesis or comma when parsing argument list for SCRIPT_REAL

Environment

  • Tableau Desktop
  • R-Integration

Resolution

When referencing strings in any R-code, use a single quote instead of double quotes. For example, instead of using the following:
Script_real(" 
data<-.arg1 
f1<-fitdistr(data, "normal") 
",SUM(data))

Use the following:
Script_real(" 
data<-.arg1 
f1<-fitdistr(data, 'normal') 
",SUM(data))

Cause

SCRIPT functions use double-quotes to  determine where the R-code starts and stops. Using double quotes within the argument will give a syntax error.
Did this article resolve the issue?