Hi guys,
I have written some code that allows me to create a violin plot in R Studio using the ggplot package.
It's quite simple...
ggplot(LifeExpectancy,aes(Range,X))+ geom_violin()
LifeExpectancy being my data set. Range being my categories and X being my measure.
I have inputted this into the R-tool in alteryx and have succesfully recreated the plot (adding code that calls and activates the ggplot package).
However, the aim of was to be able to recreate a violin plot in Tableau, and use alteryx to manipulate the data to do so.
I have written a code which pulls the data I need to do so.
ggplut_build(ggplot(LifeExpectancy,aes(Range,X))+ geom_violin())
In R-Studio I can write a code using the Marray tool which allows me to output this as a file called "Violin", i can then input this data set and create a workflow in alteryx that solves the problem I need.
write.list(ggplot_build(ggplot(Life,aes(Range, X))+ geom_violin()), filename = "Violin", append = FALSE, closefile = TRUE, outfile)
However, I cannot write a code within the alteryx R-Tool that succesfully provides me with a written output which then goes straight into my tableau manipulation workflow.
Does anyone have any solutions that I could try, or any experience writing complex outputs with the R-Tool in alteryx? I beleive the solution is to some how manipulate the ggplot_build (which outputs as a list) into a data frame, which I beleive can be outputted within the R-tool.
Any help is appreciated!
Documents that may help are attached.
ViolinBuild.yxmd - my alteryx workflow which turns my written file output from R into a tableau suitable format.
R-Tool.yxmd - my workflow that uses the R-Tool to install the ggplot package and then run the ggplot_build function.
LifeExpectancy.csv - my dataset
Ben
Solved! Go to Solution.
Issue resolved by replacing the write.list function which would succesfully output in R-Studio with the layer_data tool.
So changing...
write.list(ggplot_build(ggplot(Life,aes(Range, X))+ geom_violin()), filename = "Violin", append = FALSE, closefile = TRUE, outfile)
to
layer_data(ggplot(LifeExpectancy,aes(Range, X))+ geom_violin() , i = 1L)
Thanks to Phil Lowe of The Information Lab for his help.
Ben
Hi Ben,
Hope are doing good !
Finally I trapped you on Alteryx Community. (I tried to connect with you on YouTube (comment section of Youtube), Linkedin and Twitter.)
I wanted to understand this magical process.
How do I approach Violin and Contour plots in Tableau ?
Thanks,
Sumeet
*** Note :- I am new user to Alteryx :(