2 Replies Latest reply on Nov 11, 2019 7:25 AM by Walid Gamal

    Chi Square with Tableau + R

    Karim Amjad

      I have some aggregate fields [TL] [TR] [BR] [BL] they all do a distinct count.

       

       

      When I try to run this code in Tableau

       

       

      SCRIPT_str(

      "

      first<-c(.arg2,.arg3);

      second<-c(.arg1,.arg4);

      r<-data.frame(data.frame(kuta), data.frame(kamina));

      e<- paste(chisq.test(r, correct=F)$p.value)

      print(e);

      ",[TL],[TR],[BR],[BL])END

       

      My tableau column chiSQ_working just returns ZERO

      If I hard core the parameters I get the same result as above (My tableau just returns ZERO)

      However if I hard code values inside of the R script, the tableau script is able to compute the chi sq p value

      Then the calculation works, but of course it assigns each row the p value

       

      It seems that Tableau is unable to parse through aggregated numbers to the R script
      What is the fix?