Skip to content
Prev 142635 / 398498 Next

Feed list of vectors to vioplot()?

<posted & mailed>

Thanks for the very appropriate scolding.

Here's my example (based on "?vioplot"):
mu<-2
si<-0.6
bimodal<-c(rnorm(1000,-mu,si),rnorm(1000,mu,si))
uniform<-runif(2000,-4,4)
normal<-rnorm(2000,0,3)
# Working just fine
myfunction1 <- function(x, ...){vioplot(x,...)}
myfunction1(bimodal,uniform,normal)
# What I (believe to) need
myfunction2 <- function(x, ...){
  mylist <- list(x, ...)
  # plenty of "lapply" stuff
  vioplot(mylist)
}
myfunction2(bimodal,uniform,normal)
        --> Error in min(data) : invalid 'type' (list) of argument

I'm at a loss on how to disentangle "mylist" - unlist just gives me one big
vector back rather than the 3 I want to have back ...

Thanks for your patience, Joh
jim holtman wrote: