Skip to content

Instantly share code, notes, and snippets.

@rparrish
Created December 22, 2013 17:58
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 2 You must be signed in to fork a gist
  • Save rparrish/8086147 to your computer and use it in GitHub Desktop.
Save rparrish/8086147 to your computer and use it in GitHub Desktop.
This calculated field in Tableau includes a debugging function that outputs the data being sent to and from RServe.
IF FIRST() == 0 THEN
SCRIPT_REAL('
debug <- TRUE
## R Comment
results <- mean(.arg1)
## Debug output
if (debug) {
sink("TableauR_debug.txt", append=TRUE)
print("######## START ####")
print("######## Arithmetic LOS")
print(date())
print("incoming from Tableau")
print(.arg1)
print("back to Tableau")
str(results)
results
print("######## END ####")
print("")
sink()
}
results
',
SUM([LOS]) //.arg1
)
END
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment