Re: [R] Combining boxplot

2013-02-25 Thread soon yi
does this work for you? df1 = data.frame(x = rnorm(100)) df1$type = ifelse(df1$x <= 0 , "type1", "type2") df1$group<-1 df2 = data.frame(x = rnorm(50,0,2)) df2$type = ifelse(df2$x <= 0 , "type1", "type2") df2$group<-2 combined.df<-rbind(df1,df2) boxplot(combined.df$x ~ combined.df$group *co

Re: [R] Combining boxplot

2013-02-25 Thread William Dunlap
Does the following produce what you want? > lst <- c(Observed=with(df1, split(x, type)), Simulated=with(df2, split(x, type))) > lst <- lst[c(seq(1,length(lst)-1,by=2), seq(2,length(lst),by=2))] > boxplot(lst, col=rep(c("gray","red"),len=length(lst))) Bill Dunlap Spotfire, TIBCO Software