Skip to main content

So, with help from Jim Wahl & Jonathan Drummey, I'm successfully sending values to R and receiving the expected results of a basic calculation. R integration: Basic calculations

 

Now, the problem I've run into is creating a line graph from the results. In the example shown below, the LOS Average is calculated by Tableau and the Geometric Mean LOS (GMLOS) is being calculated via R.  A bar graph works ok for GMLOS  but a Line graph does not. The values are being recalculated when the mark type is changed from bar to line.

 

Any suggestions?

 

R integration: basic calculations & graphs (Part2)

 

12-21-2013+10-27-18+AM.jpg

11 Antworten
  1. 24. Dez. 2013, 13:20

    All it took was some pre-Christmas dinner with family to get my brain working again and remember Joe's solution for unwanted densification. To take care of that and finish getting the lines to draw in your workbook, there are two major steps, seen in Line Fixed part 1 and Line fixed part 2 in the attached workbook:

     

    1) We can turn off the Mark Type Filling by only having aggregate measures on Columns and Rows. Where we need a discrete (blue) pill to generate headrs, we can use a discrete aggregate like MIN(), MAX(), or ATTR(). So I put Group on the Level of Detail and MIN(Group) on Columns. (For performance, when I'm sure about the level of detail in a view I'll use MIN() or MAX() because ATTR() is somewhat slower).

     

    However, this leaves 4 individual marks that are not connected into a line:

     

    All it took was some pre-Christmas dinner with family to get my brain working again and remember Joe's solution for unwanted densification.

     

    There are 2 related issues with getting the marks to draw a line:

     

    a) We have 4 plotted marks and 12 Nulls. Ordinarily we can filter out those Nulls and Tableau will connect the 4 marks, for example by putting a copy of hte Geometric LOS on the Filters Shelf and filtering for non-Null values, but that won't work without some other changes, because...

     

    b) There are two dimensions (ID and Group) on the Level of Detail Shelf. Tableau can generally connect marks into a line across one dimension, but not when there are multiple dimensions on the same Shelf - that creates panes/partitions. The Path Shelf can be an option to connect marks, but it also won't cross the multiple dimension boundary (as far as I know)

     

    The solution is to create a Tableau Combined Field of ID & Group, and put that on the Level of Detail, and apply the Geometric LOS filter from a) - we could generate a sort of the Combined Field, but using Geometric LOS filter is faster. Tableau Combined Fields can still address & partition on the individual dimensions in the Combined Field, while being treated as one dimension for the line:

     

    Screen+Shot+2013-12-24+at+8.04.50+AM.PNG.png

     

    Rollie, I don't know your volumes, if you have tens of thousands of records or more (ideally hundreds of thousands of records) I'd be curious as to which is faster, the Tableau & R calcs or the Tableau-only calcs. My hunch is that with a decently fast data source such as a Tableau data extract or tuned database that the Tableau-only solution would be faster because there is less data that has to be pushed across the wire from the data source to Tableau and Tableau into R & back again.

     

    Also, I personally think this is more complicated than it needs to be. Even though we have a workable solution to get a line, it requires knowing about multiple undocumented features of the software.

0/9000