1 Reply Latest reply on Feb 14, 2018 4:52 AM by Yuriy Fal

    R script doesn't work in Tableau. It works well in R.

    Ahu Oral

      Hi,

       

      I am new in Tableau and trying to run the following R script in Tableau.

       

       

      library(SPREDA)

      status <- rep(.arg1,.arg2)

      lifetime <- rep(.arg3,.arg2)

      fit <- Lifedata.MLE(Surv(lifetime,status)~1,

                                  dist='weibull')

      fit$min

       

       

      The calculated field in Tableau is:

       

       

      SCRIPT_REAL(

      "

      library(SPREDA);

      status <- rep(.arg1,.arg2);

      lifetime <- rep(.arg3,.arg2);

      fit <- Lifedata.MLE(Surv(lifetime,status)~1,

                                  dist='weibull')

      fit$min

      ",

      SUM([Status]), SUM([Count]), SUM([Lifetime]))

       

       

      • I am getting different errors. Two hours ago I got time[[i]] <- sort(unique(y[who, 1])) : attempt to select less than one element in integerOneIndex error
      • Now, I am getting package 'survival' could not be loaded error
      • I am using Tableau 10.4 and R 3.4 within RStudio
      • The script works well in R.
      • Rserve is active
      • I read similar issues and applied some solutions but they didn't work.

       

      Thanks

      Ahu