I would like to generate some violin plots using the vioplot library. Unfortunaly, vioplot takes vector as arguments. So it works as follow, but it's ugly:
library(vioplot)
x1 = rnorm(200, 10, 5)
x2 = rnorm(200, 20, 5)
x3 = rnorm(200, 30, 5)
x4 = rnorm(200, 10, 15)
x5 = rnorm(200, 10, 25)
x6 = rnorm(200, 20, 35)
x7 = rnorm(200, 40, 15)
x8 = rnorm(200, 50, 15)
// x9 and more .....
// plot
vioplot(x1,x2,x3,x4,x5,x6,x7,x8)
// vioplot(x1 to x20 ) ?
How can I improve it with a loop for example?
I would like to do something like :
// Generate a random data frame
df = data.frame()
for (i in 1:100)
{
df = cbind(df, rnorm(200, 10, i))
}
// This line is not working
vioplot(df[1:15],)
I think I need some meta programming to generate my argument list