1 Reply Latest reply on Jan 19, 2014 12:55 AM by Jim Wahl

    passing string data to R

    Bala Deshpande

      I have a Dimension called "Q8" consisting of character string data (which is really a bunch of 300+ survey responses). I want to use R for text mining and then display some visuals in Tableau. To this end, i want to pass these data to R and doing it this way

       

      I set up a calculated field called "NumResp" to do some basic stuff as follows:

       

      SCRIPT_INT("length(readLines(TEXTFILE) <- .arg1", ATTR(Q8))

       

      The corresponding command in R > length(readLines(TEXTFILE <- Q8)) works and returns an integer (346). However Tableau gives this error2014-01-18_1154.png

       

      Any ideas? Thanks in advance.

        • 1. Re: passing string data to R
          Jim Wahl

          Try:

          SCRIPT_INT("length(.arg1)", ATTR(Q8))

           

          When adding this formula to the view, Q8 needs to be in the view, either in the Row/Cols/Color/Shape... or on the Detail button. You may also need to click on Compute Using > Q8.

           

          Tableau will pass the members of the Q8 dimension to R as a vector.

          1 of 1 people found this helpful