I want to make a graph with four violin plots of four different groups. I am getting an error and I do not know what to fix. Each group (clusters) has two columns, a group identifier and age values (in months). This is the code that I tried to run.
library(vioplot)
vioplot(cluster1, cluster2, cluster3, clusterTD, names = c("Group 1","Group 2","Group 3","Group 4 (TD)"), col=(c("hotpink", "darkorange1", "mediumpurple1", "blue")))
title("Violin Plots of Age in Months"))
This is the error that I got.
Error in
[.data.frame
(x, order(x, na.last = na.last, decreasing = decreasing)) : undefined columns selected
Does anyone know what I am doing wrong?
How do I interpret what the error message?
Is this because x and y are not defined clearly?
I want the y axis to be the Age values and the x to be the group (clusters), so that there are four groups.
I really appreciate any help that I receive!!