Instruction for Using Tableau/R

You should:

  1. In Tableau, create a calculated field.
  2. In the formula space enter this code: (substituting total sales units for your variable)
    • SCRIPT_REAL('ncomp <- scale(.arg1)',sum([Total Sales Units]))
  3. You will need to start R as a server (see zip file with command and R code; edit the cmd file to point to your version of R).
  4. Finally, in Tableau under Help->Settings and Performance ->Manager R connection, enter the following:

  • Credits go to Benjamin Daniel.