This article describes how to go from a crosstab table in Displayr...
...to an editable PowerPoint snake chart:Note: you can create a Snake chart in Displayr (Visualization > Line > Snake with Tests) and export it to PowerPoint as an image. PowerPoint doesn't support a Snake Chart type output. Nevertheless, this type of output is often used in reporting. Researchers have found a workaround involving restructuring the data and charting it as a Scatter plot. This article contains the steps to automate the process.
Method
- Create a crosstab selecting the question you wish to show as lines in Columns (age in the table above).
- From the toolbar, go to Calculation
> Custom Code and click on the Page to place the output.
-
Update and input the code below into the R Code editor. You must update the table name in row 2 of the code. You can find the table's name by selecting the table and going to General > General > Name in the object inspector
.
#specify table thetab=table.Income.by.Age #load reshape library(reshape2) #remove nets thetab=thetab[rownames(thetab) != "NET",colnames(thetab) != "NET" ] #melt the table to long format thetab.m=melt(thetab) #create a similar table for the axes axis.m=thetab.m #change the values to the sequential axis values based on how many columns were melted axis.m[,"value"]=seq(NROW(axis.m)/length(unique(axis.m$Var2)),1,-1) #merge the two long data together merged=Cbind(thetab.m,axis.m) #make the data wide keeping pcts long but axis values into individual columns wide = dcast(merged, thetab.m.Var2 + thetab.m.Var1 + thetab.m.value ~ axis.m.Var2, value.var="axis.m.value") #remove the unneeded column names wide.2 = wide[,!colnames(wide) %in% c("thetab.m.Var2")] wide.2[,-1] - The above code will reformat the table into the correct format for the desired chart type.
- In the object inspector
, select the output, go to Appearance > PowerPoint Export > Format, and select Microsoft Chart.
- Set Export as to X Y Scatter Lines (or another Scatter type).
- Go to Share > Export Report > PowerPoint > Create New Document > Export.
- Open the exported file in PowerPoint and reformat the chart.
Next
Exporting and Updating PowerPoint Reports Video Series
How to Retrospectively Link PowerPoint Tables and Charts to Displayr Outputs